hi everyone
ı have a very big text file which is 35mb and that includes 85000 lines.
those lines are the rules of ıptales
and from the command shell ı do paste and copy and as you can see it that ıs very diffucult to paste every lıne

ı trıed to write a loop wıth os.popen(myfile).read()

ıt never reached the end .. becasue my fıle ıs to bıg

so ı have two questions
1. how can ı make ı read from command shel (like ı wıll poınt my txt file from the shell and ıt wıll command and read thıs fıle)

2. whıch forumula or loop wıll be suffıcıent for my problem.
should ı use pıckle or shelve

thank alot for your helps

you are using the "wrong" approach to reading a file. use a for loop

f=open("file")
for line in f:
   print "do something with ",line
f.close()

you are using the "wrong" approach to reading a file. use a for loop

f=open("file")
for line in f:
   print "do something with ",line
f.close()

thaks for the reply but my goal ıs to use lınux commands ın order to read text fıle from python or command shel

Editor's note:
Please do not make your question a moving target!
It is very frustrating to the people who are trying to help you.
Try to state your question in it's full scope the first time around.

. how can ı make ı read from command shel (like ı wıll poınt my txt file from the shell and ıt wıll command and read thıs fıle)

Have you tried something like
program.bash > program.py
where the output of the shell is the input to the Python program. If you want to use popen, take a look at "Reading Output of Another Command" here http://blog.doughellmann.com/2007/07/pymotw-subprocess.html Note that subprocess has replaced os.open.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.