David wrote:
Martin Walsh wrote:
Just one more comment, string.join is deprecated, yet join is a method
of str objects. So ...
Lines = '\n'.join(L)
... or use textwrap.fill which returns a string with the newlines
already in place ...
Lines = textwrap.fill(USE, 80)
HTH,
Marty
Again thanks, I like the comments :)
-david
Ok here is what I have now;
#!/usr/bin/python
import textwrap
def get_use():
fname = open('/tmp/comprookie2000/emerge_info.txt')
for line in fname:
if 'USE' in line:
output = line.split('"')[1]
USE = textwrap.fill(output, 80)
break
else:
USE = ''
fname.close()
get_use()
Here is the whole program so far, what it does is it logs into a druple
web site and posts. I would like to make it better, as you can see I do
the same thing over and over. Also I don't think this is a python
problem but I can only post one line or I get HTTP/1.1 417 Expectation
Failed. I thought the problem was because it was one long string, but
that is solved, may be it is looking for return/Enter to be pressed, not
sure.
http://linuxcrazy.pastebin.com/m7689c088
thanks
-david
--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor