Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25659

RE: help

From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Subject RE: help
Date 2012-07-19 23:26 +0000
References <E11474306C04254C871D4C0B6AE5CA6F1E81F8BF@SN2PRD0202MB131.namprd02.prod.outlook.com>
Newsgroups comp.lang.python
Message-ID <mailman.2325.1342741039.4697.python-list@python.org> (permalink)

Show all headers | View raw


>('per1','persona1.1','pro1'),('per1','persona1.1','pro2'),('per1','persona1.1','pro3'),('per1','persona1.1','pro4'),('per1','persona1.1','pro5'),('per2','persona2.1','pro1'),('per2','persona2.1','pro2'),('per2','persona2.1','pro3'),('per2','persona2.1','pro4'),('per2','persona2.1','pro5'),('per2','persona2.2','pro1'),('per2','persona2.2','pro2'),('per2','persona2.2','pro3'),('per2','persona2.2','pro4'),('per2','persona2.2','pro5'),('per2','persona2.3','pro1'),('per2','persona2.3','pro2'),('per2','persona2.3','pro3'),('per2','persona2.3','pro4'),('per2','persona2.3','pro5'),('per2','persona2.4','pro1'),('per2','persona2.4','pro2'),('per2','persona2.4','pro3'

You can use ast.literal_eval if you add an enclosing () or [] in the string 
(and add a finishing paren for the last tuple).

>the string is made with fors, using data from another file, and I need it as a tuplelist

If you are transferring this data (network/file) you may want to take a 
look at pickle/json. If you are doing this to convert to/from a CSV then look at
the csv module. If you say what are you trying to do and why, someone on the
list might be able to recommend a better way to do this.

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: help  "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-19 23:26 +0000

csiph-web