Che M wrote:
Ken,
I would also recommend trying out databases, if you have an interest.
I found them a fun new aspect of using Python. I would recommend
using SQLite, which very conveniently comes with Python. Alan Gauld's
tutorial that you've read part of has a nice section on Working w
Albert Sweigart wrote:
Ken,
You should probably use the sorting functionality that your DBMS
provides. However, if you have a list of strings that end with a new
line and start with an apostrophe, you can use list comprehensions to
remove them:
newlist = [x[1:-1] for x in newlist]
You can look
Ken,
I would also recommend trying out databases, if you have an interest.
I found them a fun new aspect of using Python. I would recommend using
SQLite, which very conveniently comes with Python. Alan Gauld's
tutorial that you've read part of has a nice section on Working with Databases,
Shashwat Anand wrote:
I intended to sort a list which sorts according to user-defined custom
sorting-order.
For example: If sorting-order is "zabc...wxy", then the output will be
in lexicographically sorted order but z will always be given priority
over rest others.
as a test case i took sortin
next part --
> An HTML attachment was scrubbed...
> URL:
> <http://mail.python.org/pipermail/tutor/attachments/20091123/fb03a325/attachment.htm>
>
> --
>
> ___
> Tutor maillist - tu
I intended to sort a list which sorts according to user-defined custom
sorting-order.
For example: If sorting-order is "zabc...wxy", then the output will be in
lexicographically sorted order but z will always be given priority over rest
others.
as a test case i took sorting order as reverse of norm
Luhmann wrote:
I'd suggest you load all your data into a list of lists, then use the
.sort() method to sort it.
The sort method takes a key= argument, which should be a function that
does some transformation to your data, then returns something to be
compared.
for instance:
>>> l=[[1,2,3],[
On Mon, Nov 23, 2009 at 12:23, Wayne Werner wrote:
> On Mon, Nov 23, 2009 at 12:28 PM, Richard D. Moores
> wrote:
>>
>> Can't find the answer in the docs for 3.1
>>
>> To print 123**34.6 to 5 sig digits,
>>
>> print("%.*e" % (4, 123**34.6))
>>
>> will do the job:
>>
>> >>> print("%.*e" % (4, 123*
On Mon, Nov 23, 2009 at 12:28 PM, Richard D. Moores wrote:
> Can't find the answer in the docs for 3.1
>
> To print 123**34.6 to 5 sig digits,
>
> print("%.*e" % (4, 123**34.6))
>
> will do the job:
>
> >>> print("%.*e" % (4, 123**34.6))
> 2.0451e+72
>
> However, if the number is 123**346, using
>
Can't find the answer in the docs for 3.1
To print 123**34.6 to 5 sig digits,
print("%.*e" % (4, 123**34.6))
will do the job:
>>> print("%.*e" % (4, 123**34.6))
2.0451e+72
However, if the number is 123**346, using
print("%.*e" % (4, 123**346))
gets me
>>> print("%.*e" % (5, 123**346))
Trace
Stephen Nelson-Smith wrote:
> Martin,
>
>>def __iter__(self):
>>while True:
>>for logline in self.logfile:
>>heappush(self.heap, (timestamp(logline), logline))
>>if len(self.heap) >= self.jitter:
>>break
>>try:
Hi Mark,
When i started off i had pretty much the same questions. I think you need to
start with the Python tutorial as it will show you the basics (from the
Python shell and how to write and run Python files, to language syntax +
keywords and how to define and use functions, classes, modules etc)
"Ken G." wrote:
> I have not use the DBMS as I am unaware of them in both languages.
DBMS is short for Data Base Management System, see wikipedia entry on the topic.
Actually, the term is a bit ambiguous:
* From a user point of view, a BDMS will be an application allowing managing
data sets
Martin,
> def __iter__(self):
> while True:
> for logline in self.logfile:
> heappush(self.heap, (timestamp(logline), logline))
> if len(self.heap) >= self.jitter:
> break
> try:
> yield heappop(self.he
14 matches
Mail list logo