to filter "}"

A forum for general discussion of the Python programming language. to filter "}"

Postby alabview » Tue Oct 29, 2013 9:30 am

Hi there,

I have no idea how to remove "}". My code is below,

Code: Select all

When I perform querying....
Code: Select all

So, I would like to remove "}" after "1000" and no idea how to do.

Many Thanks.
Posts: 22
Joined: Mon Sep 16, 2013 1:48 pm

Re: to filter "}"

Postby metulburr » Tue Oct 29, 2013 9:45 am

Code: Select all
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
User avatar
Posts: 1947
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: to filter "}"

Postby micseydel » Tue Oct 29, 2013 4:35 pm

How about str.rstrip?
Join the #python-forum IRC channel on for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2252
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: to filter "}"

Postby ochichinyezaboombwa » Tue Oct 29, 2013 5:59 pm

And could you please stop CAPITALIZING EVERYTHING? It hurts my eyes.
Posts: 203
Joined: Tue Jun 04, 2013 7:53 pm

Re: to filter "}"

Postby bunburya » Fri Nov 08, 2013 1:41 am

If the variables are to be used as constants, then PEP8 says they should be given names in ALL_CAPS.

Micseydel's rstrip idea seems better to me than [:-1], with the caveat that it will not work correctly if the final value contained in the curly braces also ends with a '}'. |

Join the #python-forum IRC channel on!
Posts: 10
Joined: Sat Feb 09, 2013 7:28 pm
Location: Dublin, Ireland

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests