473,406 Members | 2,467 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,406 software developers and data experts.

Parsing numbers separated with different number of blanks

Hello,

I wonder how I can parsing and recognize the numbers below.
The problem is.. it has blanks between numbers but the number of blank is not consistent due to the sign and digit of number are taken as one column.
Perhaps, I have to first change the blanks to tab?

-4 0 -7 -3 -1 0

Thanks in advance.

Y.
Jul 29 '13 #1
1 1333
bvdet
2,851 Expert Mod 2GB
Assuming your data is a string:
Expand|Select|Wrap|Line Numbers
  1. >>> s = "-4 0 -7 -3 -1 0"
  2. >>> data = [int(x) for x in s.split()]
  3. >>> data
  4. [-4, 0, -7, -3, -1, 0]
  5. >>> 
Jul 29 '13 #2

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

Similar topics

1
by: Cliff Martin | last post by:
I know this is popular subject on this group, and I have reviewed a few messages, but they don't seem to help in my case. Most of the examples skip repeated separators. I need to read them as a...
3
by: William Vidal | last post by:
I have a client application which is using a specific library. This library can have different versions and I would like to have only one application flexible to be used with all different versions...
11
by: Masud | last post by:
hi, for a test i want to generate different random numbers between different ranges in a single loop. I tried to solve in the following way but it always profile same value. I am looking for...
0
by: =?Utf-8?B?UHVjY2E=?= | last post by:
I Have the following in my own library project and I call it from my C# application twice each time to get Unix group account information and user account information. But it would return...
2
by: aabdulrehmann | last post by:
how can i use bit i have a programe user input 10 numbers in pairs if number is greater than 50 itwill save in char file if it is less than 50 than it will save in int file
1
by: Chiefy | last post by:
Im writing in C# and I currently have a class called allocation that has random numbers like, students.choiceTwo = Randnum.Next(15); obviously using the Random class. The random numbers are part...
2
by: doby48 | last post by:
I have an html document and an XSLT currently. The XML that I need to parse is on a different remote server. Now, the XSLT works without issue as does the HTML document with XMLDOM if the XML file is...
3
by: johnmcmadeup | last post by:
How can I make it so that, if the user inputs 2 numbers with a space in between , I can get both numbers(instead of just the first number, which happens when I try cin>>var;)?
4
by: Suprim | last post by:
Hi...I want to get the different random number for each time when the application is run. For example : When i run the application, if i got 3 as the random number for the first time then when i...
13
by: haobijam | last post by:
I would like to parse tab separated .txt files separating common attribute and distinct attribute from the file. I would like to parse only the first line attributes not the values. Could you please...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.