Length on an input parameter in python
Skip Montanaro
skip at pobox.com
Thu Oct 11 12:32:51 EDT 2001
>> It looks like the length of an input parameter (taken from the
>> command line atleast) is limited to 256 characters. Is there a way
>> around this? can I set something? can I use something special? or is
>> there no way around this?
Must be system-dependent. On my system I can read lines longer than 256
characters from console stdin:
% python
Python 2.2a4+ (#4, Oct 8 2001, 09:49:18)
[GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = raw_input("Enter long line: ")
Enter long line: ssssssss... bunch of s's elided ...ssssssss
>>> print len(s)
377
and get parameters from the command line that are longer than 256
characters:
% cat longparm.py
#!/usr/bin/env python
import sys
print map(len, sys.argv)
% python longparm.py sssssss... bunch of s's elided ...sssssssssssssssss
[11, 377]
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list