Wes James wrote:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
The [] is simple since I can just check if value == [] then return []
But with ['a','b'] I have tried and get:
a=['a','b']
Wes James wrote:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
The [] is simple since I can just check if value == [] then return []
But with ['a','b'] I have tried and get:
a=['a','b']
On Thu, Feb 18, 2010 at 8:18 AM, Tim Chase
python.l...@tim.thechases.com wrote:
Wes James wrote:
snip
Just to add to the list of solutions I've seen, letting the built-in csv
module do the heavy lifting:
s = ['a','b']
import csv
no_brackets = s[1:-1] # s.strip(' \t[]')
c =
On Thu, Feb 18, 2010 at 12:32 PM, Wes James compte...@gmail.com wrote:
On Thu, Feb 18, 2010 at 8:18 AM, Tim Chase
python.l...@tim.thechases.com wrote:
Wes James wrote:
snip
Just to add to the list of solutions I've seen, letting the built-in csv
module do the heavy lifting:
s =
import csv
class IS_LIST():
def __init__(self, format='', error_message='must be a list!'):
self.format = format
self.error_message = error_message
def __call__(self, value):
try:
if value=='[]' or value=='':
value=[]
else:
On Thu, Feb 18, 2010 at 2:56 PM, Wes James compte...@gmail.com wrote:
I get an error (when I take the try out):
AttributeError: 'function' object has no attribute 'reader'
You have a function called csv that's defined after the import csv
statement is executed. That function has no
In article mailman.2736.1266522979.28905.python-l...@python.org,
Wes James compte...@gmail.com wrote:
try:
if value=3D=3D'[]' or value=3D=3D'':
value=3D[]
else:
no_brackets =3D value[1:-1] # s.strip(' \t[]')
c =3D
On Thu, 18 Feb 2010 14:52:29 -, nn prueba...@latinmail.com wrote:
Wes James wrote:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
The [] is simple since I can just check if value == [] then
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
The [] is simple since I can just check if value == [] then return []
But with ['a','b'] I have tried and get:
a=['a','b']
b=a[1:-1].split(',')
2010/2/18 Wes James compte...@gmail.com:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
The [] is simple since I can just check if value == [] then return []
But with ['a','b'] I have tried
On Wed, 17 Feb 2010 23:48:38 -, Wes James compte...@gmail.com wrote:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
If your string is trusted (i.e. goes nowhere near a user), just eval() it.
On Thu, 18 Feb 2010 00:13:05 +, Rhodri James wrote:
On Wed, 17 Feb 2010 23:48:38 -, Wes James compte...@gmail.com
wrote:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
If your
Wes James comptekki at gmail.com writes:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
The [] is simple since I can just check if value == [] then return []
But with ['a','b'] I have
Wes James compte...@gmail.com writes:
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. [] or
['a','b']
Pulling back to ask about the larger problem: Are you trying to create
Python data structures from a
14 matches
Mail list logo