You are not logged in.

#1 2015-08-08 02:15:17

j2lapoin
Banned
Registered: 2013-06-28
Posts: 102

array or better

my actual goal is to conceive a frontend for pacman in python.
(similar to this one at first)

mmyd1s.png

I have all of my frontend divided in sections. each section is a file that i open and close to get information. I can't manage so far to combine them in the same code. I'm wonder if i should use somes kind of arrays to collect each section data. my objectif is to have them reunite on the same code or at least same program. 

example of a section.

# Open a file
words=""

with open("bd1.txt", "r") as fh:      

    for index in range(1):
        line = next(fh)
        print ("%s" % (line))
        line = next(fh) 

    content=fh.readlines()

    for lines in content:
        if (lines[-12:] == "[installed]\n"):
            lines1=(lines.replace("[installed]",""))
            lines2=(lines1.replace(" ","/"))
            lines3=(lines2.split("/")[1])
            print (lines3)

# Close opend file
fh.close()

this one withdraw from pacman -Ss, filename only.

I got 3 others that withdraw information from this database (pacman -Ss).

* how can i use this code to return an array?

Offline

Board footer

Powered by FluxBB