LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2009, 11:19 AM   #1
cmnorton
Member
 
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35
List's pop method throws string exception


I have a python list that looks like this:

9999,"OCTOPUS FRED & ETHYL",972,98,7/1/1883,325,"001.0-0001-0099.0"

I want to remove the (") characters from the list.

What is the best way to remove these characters?

Before putting this line into a list, it was a string, but I could not get the string's replace method to work, replacing '"' with ''.

The error I am getting from the list is the string has no pop or remove attribute. (I have tried several ways to remove the quotes from the list.)

Any pointers would be appreciated.
 
Old 04-08-2009, 11:48 AM   #2
cmnorton
Member
 
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Original Poster
Rep: Reputation: 35
Problem solved

mylist = line.strip('\n').replace('\"','')

I forgot strings are immutable, and I needed to save off a copy of the string without trying to change it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unison backup Uncaught exception Invalid_argument("String.create") uhcafigdc Linux - Software 2 05-22-2009 01:02 PM
Signed applet throws SocketPermission Exception adilturbo Programming 7 04-21-2008 12:24 PM
The method contains(String) is undefined for the type String sampada Programming 1 06-30-2007 10:02 AM
help createing exception class from base STL exception qwijibow Programming 4 04-20-2005 05:23 AM
Runtime Exception vs. Exception mikeshn Programming 1 09-22-2002 05:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration