473,386 Members | 1,846 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,386 software developers and data experts.

Parsing Data, Storing into an array, Infinite Backslashes

I am using this function to parse data I have stored in an array.

This is what the array looks like:

[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory', '0',
'ConfigurationType', '2'], ['Memory', '1', 'Summary', '0'], ['Memory',
'1', 'Speed', 'PC3200U-30330'], ['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '1', 'Size', '512'], ['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationType', '2'], ['Memory', '2', 'Summary',
'0'], ['Memory', '2', 'Speed', 'PC3200U-30330'], ['Memory', '2',
'Type', 'DDR SDRAM'], ['Memory', '2', 'Size', '512'], ['Memory', '2',
'Slot', 'DIMM2/J13'], ['Memory', '2', 'ConfigurationType', '2'],
['Memory', '3', 'Summary', '0'], ['Memory', '3', 'Speed',
'PC3200U-30330'], ['Memory', '3', 'Type', 'DDR SDRAM'], ['Memory', '3',
'Size', '512'], ['Memory', '3', 'Slot', 'DIMM3/J14'], ['Memory', '3',
'ConfigurationType', '2']]

This is the code to parse the array:

count=0
place=0
query=[]
while 1:
try:
i=fetch.next()
except StopIteration:
break
if i[1] != count:
++count
query.append(count)
qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

print qval,"\n"

When it runs I get an output similar to this.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Type =DDR
SDRAM,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\'Size=512,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\'Slot=DIMM2/J13,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\'ConfigurationType=2,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Summary=0,
\\\\\\\\\\\\\\\'Speed=PC3200U-30330, \\\\\\\'Type=DDR SDRAM,
\\\'Size=512, \'Slot=DIMM3/J14, '

When it's supposed to print just the plain text with the numbers etc.

I have changed these lines:

qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

To this:

query[count]=query[count]+i[2]+"="+i[3]+", "

I get this error:

Traceback (most recent call last): File "infnode.py", line 60, in ?
query[count]=query[count]+i[2]+"="+i[3]+", "TypeError: unsupported
operand type(s) for +: 'int' and 'str'

So I try and fix it by doing this:

query[count]=`query[count]`+i[2]+"="+i[3]+", "

Can someone please point me in the right direction I am sure that the
`query[count]` is causing the backslashes.

Thanks in advance.

Jul 21 '05 #1
6 2025
Your code is needlessly complicated.

Instead of this business
while 1:
try:
i = fetch.next()
except stopIteration:
break
simply write:
for i in fetch:
(if there's an explicit 'fetch = iter(somethingelse)' in code you did
not show, then get rid of that and just loop 'for i in somethingelse')

i[1] will never compare equal to count, because i[1] is always a string
and count is always an integer. Integers and strings are never equal to
each other.

Wring code like
x = "a string " + 3
does not work in Python. You can either convert to a string and then
use the + operator to concatenate:
x = "a string " + str(3)
or you can use %-formatting:
x = "a string %s" % 3
("%s" accepts any sort of object, not just strings)

Using repr(...) (`...` is just a shorthand for this) is what is really
introducing the backslashes. When it outputs a string, it quotes the
string using backslashes. But you pass the old part of the prepared
string through it each time, which leads to doubling backslashes.

Below is a program I wrote to process the data in your message. It prints
out
Memory 2 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM2/J13, ConfigurationType=2
Memory 3 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM3/J14, ConfigurationType=2
Memory 0 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM0/J11, ConfigurationType=2
Memory 1 Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM, Size=512, Slot=DIMM1/J12, ConfigurationType=2
the result is out of order because the result of calling .items() on a
dict is in an arbitrary order.

Jeff

s = [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory', '0',
'ConfigurationType', '2'], ['Memory', '1', 'Summary', '0'], ['Memory',
'1', 'Speed', 'PC3200U-30330'], ['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '1', 'Size', '512'], ['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationType', '2'], ['Memory', '2', 'Summary',
'0'], ['Memory', '2', 'Speed', 'PC3200U-30330'], ['Memory', '2',
'Type', 'DDR SDRAM'], ['Memory', '2', 'Size', '512'], ['Memory', '2',
'Slot', 'DIMM2/J13'], ['Memory', '2', 'ConfigurationType', '2'],
['Memory', '3', 'Summary', '0'], ['Memory', '3', 'Speed',
'PC3200U-30330'], ['Memory', '3', 'Type', 'DDR SDRAM'], ['Memory', '3',
'Size', '512'], ['Memory', '3', 'Slot', 'DIMM3/J14'], ['Memory', '3',
'ConfigurationType', '2']]

query = {}

for a, b, c, d in s:
if not query.has_key((a,b)): query[(a,b)] = []
query[(a,b)].append("%s=%s" % (c, d))

for (a,b), v in query.items():
print a, b, ", ".join(v)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFC0uMvJd01MZaTXX0RAm5dAKCsFownutZiB2pc2xf9PT Gb2hRyUgCfT7ti
E3RKhgPPE1u9/D5MKa1F/Ho=
=HtOG
-----END PGP SIGNATURE-----

Jul 21 '05 #2
On Mon, 11 Jul 2005 13:47:22 -0700, su***********@gmail.com wrote:
I am using this function to parse data I have stored in an array.

This is what the array looks like:

[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ... ]
[snip more of the array]
This is the code to parse the array:

count=0
place=0
place is not used in your function. Remove it.
query=[]
while 1:
try:
i=fetch.next()
What is fetch and what does fetch.next() do?

It is considered bad programming practice to use a variable i for anything
except for i in range(). i for "index", not i for "next record".
except StopIteration:
break
if i[1] != count:
What is i? A list? A tuple? A dict? What is stored in it?
++count
query.append(count)
Why are you appending the numeric value of count to the list query? Since
count starts at zero, and increases by one, your list is just [1, 2, 3, ...]
qval=`query[count]`
It looks like you are setting the variable qval to the string
representation of a number. Backticks are being depreciated, you should
write this as qval = str(query[count]).

But if I have understood your program logic correctly, query[count] up
to this point is just count. So a much simpler way is to just use qval =
str(count).
query[count]=qval+i[2]+"="+i[3]+", "
Impossible to know what this does since we don't know what i is. Hint: it
is easier to read and parse expressions by adding a small amount of
whitespace:

query[count] = qval + i[2] + "=" + i[3] + ", "
print qval,"\n"

When it runs I get an output similar to this.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Type =DDR
SDRAM,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\'Size=512,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\'Slot=DIMM2/J13,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\'ConfigurationType=2,
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Summary=0,
\\\\\\\\\\\\\\\'Speed=PC3200U-30330, \\\\\\\'Type=DDR SDRAM,
\\\'Size=512, \'Slot=DIMM3/J14, '

When it's supposed to print just the plain text with the numbers etc.

See below for some further hints.

I have changed these lines:

qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

To this:

query[count]=query[count]+i[2]+"="+i[3]+", "

I get this error:

Traceback (most recent call last): File "infnode.py", line 60, in ?
query[count]=query[count]+i[2]+"="+i[3]+", "TypeError: unsupported
operand type(s) for +: 'int' and 'str'
Yes. query[count] is an integer equal to count. i[2] is who-knows-what.
"=" is a string. You can't add strings to ints.
So I try and fix it by doing this:

query[count]=`query[count]`+i[2]+"="+i[3]+", "
That is functionally equivalent to your first version.
Can someone please point me in the right direction I am sure that the
`query[count]` is causing the backslashes.


I doubt it very much. But you can test it by adding some print lines in
your code: change this:

qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

to this:

print "Count is: ", count
print "query[count] is: ", query[count]
qval=`query[count]`
print "qval is: ", qval
query[count]=qval+i[2]+"="+i[3]+", "
print "query[count] changed.\nNew value is: ", query[count]

--
Steven.
Jul 21 '05 #3
On 11 Jul 2005 13:47:22 -0700, "su***********@gmail.com"
<su***********@gmail.com> declaimed the following in comp.lang.python:
count=0
place=0
query=[]
while 1:
try:
i=fetch.next()
Where is the fetch object defined? And what is it supposed to be
returning?
except StopIteration:
break
if i[1] != count:
++count
query.append(count)
qval=`query[count]`
query[count]=qval+i[2]+"="+i[3]+", "

print qval,"\n"
When it's supposed to print just the plain text with the numbers etc.
Which numbers? The "memory" number IN the data, or some
incremental counter you are hoping will match?

Watch out for text wrapping in the browser...

-=-=-=-=-=-=-=-=-=-

# I've deliberately re-ordered some of the items
inData = [ ['Memory', '0', 'Summary', '0'],
['Memory', '0', 'Speed', 'PC3200U-30330'],
['Memory', '0', 'Type', 'DDR SDRAM'],
['Memory', '0', 'Size', '512'],
['Memory', '0', 'Slot', 'DIMM0/J11'],
['Memory', '0', 'ConfigurationType', '2'],
['Memory', '1', 'Size', '512'],
['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationType', '2'],
['Memory', '2', 'Summary', '0'],
['Memory', '2', 'Speed', 'PC3200U-30330'],
['Memory', '2', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Size', '512'],
['Memory', '1', 'Summary', '0'],
['Memory', '1', 'Speed', 'PC3200U-30330'],
['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Slot', 'DIMM2/J13'],
['Memory', '2', 'ConfigurationType', '2'],
['Memory', '3', 'Summary', '0'],
['Memory', '3', 'Speed', 'PC3200U-30330'],
['Memory', '3', 'Type', 'DDR SDRAM'],
['Memory', '3', 'Size', '512'],
['Memory', '3', 'Slot', 'DIMM3/J14'],
['Memory', '3', 'ConfigurationType', '2'] ]

# Since I scrambled the order, lets build a dictionary to recollect
stuff
tDict = {}

for ln in inData:
if ln[0] != "Memory":
print "Bad data entry"
print ln
else:
# add a dictionary entry for memory ln[1], with key ln[2] and
value ln[3]
tDict.setdefault(ln[1], {})[ln[2]] = ln[3]

# input data has been reformatted, process each subdictionary for
output
for k, v in tDict.items():
for sk, sv in v.items():
print "%5s:\t%s=%s" % (k, sk, sv)
print
-=-=-=-=-=-=-=-=-=-=-=-
E:\UserData\Dennis Lee Bieber\My Documents>script1.py
1: Slot=DIMM1/J12
1: Speed=PC3200U-30330
1: Summary=0
1: ConfigurationType=2
1: Type=DDR SDRAM
1: Size=512

0: Slot=DIMM0/J11
0: Speed=PC3200U-30330
0: Summary=0
0: ConfigurationType=2
0: Type=DDR SDRAM
0: Size=512

3: Slot=DIMM3/J14
3: Speed=PC3200U-30330
3: Summary=0
3: ConfigurationType=2
3: Type=DDR SDRAM
3: Size=512

2: Slot=DIMM2/J13
2: Speed=PC3200U-30330
2: Summary=0
2: ConfigurationType=2
2: Type=DDR SDRAM
2: Size=512
E:\UserData\Dennis Lee Bieber\My Documents>

You'll note that using the intermediate dictionary allows me
collect mixed order data -- but without using a separate sort operation,
the retrieval is in whatever order Python gives it.

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 21 '05 #4
Thanks for all the help, I'm not sure what approach I'm going to try
but I think I'll try all of your suggestions and see which one fits
best.

The variable "i" held the following array:

[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0',
'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory', '0',
'ConfigurationType', '2'], ['Memory', '1', 'Summary', '0'], ['Memory',
'1', 'Speed', 'PC3200U-30330'], ['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '1', 'Size', '512'], ['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationType', '2'], ['Memory', '2', 'Summary',
'0'], ['Memory', '2', 'Speed', 'PC3200U-30330'], ['Memory', '2',
'Type', 'DDR SDRAM'], ['Memory', '2', 'Size', '512'], ['Memory', '2',
'Slot', 'DIMM2/J13'],
Where is the fetch object defined? And what is it supposed to be
returning?
Fetch is declared a few lines up in the program with this
fetch=iter(ed) it just goes through the array and returns the next part
of it.
query[count]=qval+i[2]+"="+i[3]+", "

Impossible to know what this does since we don't know what i is. Hint: it
is easier to read and parse expressions by adding a small amount of
whitespace:


I am trying to assign each new memory slot to a new part in the array.
So when memory is either 0,1,2,3 it will assign it to query[0],
query[1], query[2], query[3]

Jul 21 '05 #5
On 12 Jul 2005 06:21:11 -0700, "su***********@gmail.com"
<su***********@gmail.com> declaimed the following in comp.lang.python:
Thanks for all the help, I'm not sure what approach I'm going to try
but I think I'll try all of your suggestions and see which one fits
best.

The variable "i" held the following array:
Did it? Since later on you are using "i" to contain one element
from the data array.
[['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed',
'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0', <snip> 'Slot', 'DIMM2/J13'],
Fetch is declared a few lines up in the program with this
fetch=iter(ed) it just goes through the array and returns the next part
of it.
Which is a native capability of lists and tuple already.
query[count]=qval+i[2]+"="+i[3]+", "

Impossible to know what this does since we don't know what i is. Hint: it
is easier to read and parse expressions by adding a small amount of
whitespace:


I am trying to assign each new memory slot to a new part in the array.
So when memory is either 0,1,2,3 it will assign it to query[0],
query[1], query[2], query[3]


Unfortunately there are two concerns, to start with...

One, Python lists are dynamic sized -- one can not assign/append to q[3]
without having created [0]..[2]. This is one reason so many of the
attempted solutions are using dictionaries; they are unordered.

Two, the code won't behave properly if the input data is in mixed order.
You are using count to keep track of an incrementing index, but you are
(attempting) to increment it every time the data "memory" number changes
with no test for the number being a match to the next in sequence,
rather than just using the "memory" number itself for the index.

Here's a version using lists in place of the dictionary (though
I haven't fully tested it, it does handle my simple reordered data, but
I don't have a skipped number in that):

-=-=-=-=-=-=-=-=-
# I've deliberately re-ordered some of the items
inData = [ ['Memory', '0', 'Summary', '0'],
['Memory', '0', 'Speed', 'PC3200U-30330'],
['Memory', '0', 'Type', 'DDR SDRAM'],
['Memory', '0', 'Size', '512'],
['Memory', '0', 'Slot', 'DIMM0/J11'],
['Memory', '0', 'ConfigurationType', '2'],
['Memory', '1', 'Size', '512'],
['Memory', '1', 'Slot', 'DIMM1/J12'],
['Memory', '1', 'ConfigurationType', '2'],
['Memory', '2', 'Summary', '0'],
['Memory', '2', 'Speed', 'PC3200U-30330'],
['Memory', '2', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Size', '512'],
['Memory', '1', 'Summary', '0'],
['Memory', '1', 'Speed', 'PC3200U-30330'],
['Memory', '1', 'Type', 'DDR SDRAM'],
['Memory', '2', 'Slot', 'DIMM2/J13'],
['Memory', '2', 'ConfigurationType', '2'],
['Memory', '3', 'Summary', '0'],
['Memory', '3', 'Speed', 'PC3200U-30330'],
['Memory', '3', 'Type', 'DDR SDRAM'],
['Memory', '3', 'Size', '512'],
['Memory', '3', 'Slot', 'DIMM3/J14'],
['Memory', '3', 'ConfigurationType', '2'] ]

### Since I scrambled the order, lets build a dictionary to recollect
stuff
##tDict = {}
##
##for ln in inData:
## if ln[0] != "Memory":
## print "Bad data entry"
## print ln
## else:
## # add a dictionary entry for memory ln[1], with key ln[2]
and value ln[3]
## tDict.setdefault(ln[1], {})[ln[2]] = ln[3]
##
### input data has been reformatted, process each subdictionary for
output
##for k, v in tDict.items():
## for sk, sv in v.items():
## print "%5s:\t%s=%s" % (k, sk, sv)
## print

# This time, lets try to manage a list of concatenated strings
tList = []
for ln in inData:
if ln[0] != "Memory":
print "Bad data entry"
print ln
else:
ID = int(ln[1]) # convert string number to integer
item = "%s=%s" % (ln[2], ln[3])

if ID < len(tList):
# list element already allocated, but could be empty
if tList[ID]:
tList[ID] = tList[ID] + ", " + item
else:
tList[ID] = item

elif ID == len(tList):
# ID is next element to be added to list
tList.append(item)

else:
# ID skips some unallocated elements, so create them
tList = tList + ([None] * (ID - len(tList)))
tList.append(item)
# output the reformatted list
for i in range(len(tList)):
print "Memory %5s:\t%s" % (i, tList[i])

-=-=-=-=-=-=-=-=-=-

Since I put everything into a concatenated string, the lines are
too long and are wrapped by my client here...

E:\UserData\Dennis Lee Bieber\My Documents>script1.py
Memory 0: Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM,
Size=512, Slot=DIMM0/J11, ConfigurationType=2
Memory 1: Size=512, Slot=DIMM1/J12, ConfigurationType=2,
Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM
Memory 2: Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM,
Size=512, Slot=DIMM2/J13, ConfigurationType=2
Memory 3: Summary=0, Speed=PC3200U-30330, Type=DDR SDRAM,
Size=512, Slot=DIMM3/J14, ConfigurationType=2

E:\UserData\Dennis Lee Bieber\My Documents>
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 21 '05 #6
I ended up using this code to solve my problem.
for a, b, c, d in s:
if not query.has_key((a,b)): query[(a,b)] = []
query[(a,b)].append("%s=%s" % (c, d)) for (a,b), v in query.items():
print a, b, ", ".join(v)


I'm relatively new to python/programming in general. I usually write
in php and have produced this website and application
http://my-pbs.sf.net One of the things that makes php easy to program
in is the documentation provided at php.net. It is extremely easy to
find the correct functions to use. Are there any sites you could
recommend that discusses structures of loops and strings? I have an
OReilly book called, "Programming Python" and it focuses to much on
showing examples rather than structure and methods.

Thanks for the help.

Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Daniel Lidström | last post by:
Hi, I'm currently using this method to extract doubles from a string: System::String* sp = S" "; System::String* tokens = s->Trim()->Split(sp->ToCharArray()); m_Northing =...
4
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. ...
6
by: Kyle Teague | last post by:
What would give better performance, serializing a multidimensional array and storing it in a single entry in a table or storing each element of the array in a separate table and associating the...
9
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics"...
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
9
by: Paulers | last post by:
Hello, I have a log file that contains many multi-line messages. What is the best approach to take for extracting data out of each message and populating object properties to be stored in an...
2
by: RG | last post by:
I am having trouble parsing the data I need from a Serial Port Buffer. I am sending info to a microcontroller that is being echoed back that I need to remove before I start the actual important...
11
by: a | last post by:
To solve the 100k * 100k data, I finally adopt the file read method and use malloc. The system somehow knows to use virtual memory. Now I first test 1k * 1k data but something uninterpretable...
35
by: Stef Mientki | last post by:
hello, I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I can think of something like: - use a relative path if drive is identical to the application (I'm still a...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: 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
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,...

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.