473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Removing a spaces from the tailing end of a string

440 256MB
Hi,

I have a string str1 = 'Pnt ', I would like to remove the spaces from the tailing end of a string.

I/P :
str1 = 'Pnt '

O/P :

'Pnt'

Is there method available to trim the string in leading and tailing end?

I/P :
str1 = ' Pnt '

O/P :

'Pnt'

Thanks
PSB
Mar 26 '07 #1
4 2422
dshimer
136 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. >>> astring=' some text '
  2. >>> astring.strip()
  3. 'some text'
  4.  
Also check out lstrip(), and rstrip().
Mar 26 '07 #2
psbasha
440 256MB
Sorry,I have fixed it .

After working with more and more into the Python.I forgot the method ,saying that there is a "strip() " method available

-PSB
Mar 26 '07 #3
bartonc
6,596 Expert 4TB
Sorry,I have fixed it .

After working with more and more into the Python.I forgot the method ,saying that there is a "strip() " method available

-PSB
You can always:
Expand|Select|Wrap|Line Numbers
  1. >>> help(str)
for a quick reminder of all the things that strings know how to do.
Mar 27 '07 #4
psbasha
440 256MB
Thanks Barton,It is really helpful.

-PSB
Mar 27 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: hokiegal99 | last post by:
This script works as I expect, except for the last section. I want the last section to actually remove all spaces from the front and/or end of filenames. For example, a file that was named " test ...
6
by: jalkadir | last post by:
I am trying to find a way to remove the leading and tailing blanks from a string. What I have come up with is not doing the work as I expected; because if the value I pass to the function is "...
11
by: gopal srinivasan | last post by:
Hi, I have a text like this - "This is a message containing tabs and white spaces" Now this text contains tabs and white spaces. I want remove the tabs and white...
12
by: Magix | last post by:
Hi, Everytime I received a fix-length of string, let say 15 (the unused portion will filled with Spaces before receive), I want to remove the Spaces from END until I encounter a non-space char....
1
by: Mike in Paradise | last post by:
Is there a more effcient way of removing the spaces from the names for a Enumerated value that has several values when you split it)??? When you do a toString it puts ,<SPACE> between the entries...
8
by: starsky51 | last post by:
I'm sure it's something i'm doing wrong, I just can't see it. I've set up a simple page with the following code: <html> <head> <title>tester</title> <script language="javascript"...
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
1
by: Shaw | last post by:
I have a number, for example 17.7 and I want to format to a string as "17.70", with the tailing zero. Using Math.Round( dValue, 2 ) - produces "17.7". Any other functions which will do what I...
2
code green
by: code green | last post by:
I am trying to write a simple function that will take a string containing an address line or business name and return it nicely formatted. By this I mean extra spaces removed and words capitalised....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.