R. Alan Monroe | 1 Feb 01:04 2010
Picon

Re: query


> i just don wana index all the characters rather i wana double it too like 
>  ['d','a','v','i','d']
> would b 
>  ['d','dd','a','aa','v','vv','i','ii','d','dd']
> and then i wana replace all non 'd' characters with '.' a dot

> i know how replace a specific character, but i don know how to
> replace all characters other than a specific character

Hint 1: a FOR loop will help you count your way through lists one
at a time. Let the computer do the counting for you.

Hint 2: learn about IF statements to replace characters IF they're not
a d, for example.

Alan

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Benno Lang | 1 Feb 03:56 2010
Picon

Re: can any one help

On Mon, Feb 1, 2010 at 6:27 AM, invincible patriot
<invincible_patriot <at> hotmail.com> wrote:
> thanks for the reply
> i did one question
> i will tel u my progress in another question n then u tel me that what next
> must be done

<snip>

> thatz the question
> i think that first i woulf take a string 'foobar'
> convert it into a list
> take itz length
> n then do indexing
> and then multiply using for loop
>
> herez my code

<snip>

> thatz where i am
> now i wana do the indexing of each character so that i use for loop n
> multply each character with 2
>
>
> waiting for ur reply

Hi there,

I think everyone on the list would appreciate it if you wrote in
(Continue reading)

Victoria Wood | 1 Feb 05:08 2010
Picon

Re: python and sqlite

Hi, I am very new to Python myself and decided to use sqlite so I could learn about gui programming. Although it has a lot of adverts on and is short I found this tutorial very useful

http://www.devshed.com/c/a/Python/Using-SQLite-in-Python/

I hope I have replied to this correctly.

Victoria

On Sun, Jan 31, 2010 at 11:03 AM, Samuel de Champlain <
samueldechamplain <at> gmail.com> wrote:

> My project is relatively light and postgresql or mysql might be overkill.
> Does python work well with sqlite?
> If so, can you point me towards the proper libraries and manuals/tutorials?
> Thanks.
>
> ______________________________

_________________
> Tutor maillist  -  Tutor <at> python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Johann Spies | 1 Feb 06:55 2010
Picon

Deterimining the maximum length of a field in csv file

I would appreciate some help on this:

I want a script that can

1. determine the fieldnames from a csv file from the first line
2. determine the maximum length of data for each field in that file.

So far I could not figure out how to do 1 and my effort for the second
one is not working as expected.  Here is my present code:

reader = csv.DictReader(open("/media/usb0/kbase/web2py/db_scopus_rou.csv"),delimiter
= ',')
csv.field_size_limit(1000000)
reader.fieldnames  = ["scopus_rou.id","scopus_rou.Authors","scopus_rou.Title",
         "scopus_rou.Year","scopus_rou.Source_title","scopus_rou.Volume",
         "scopus_rou.Issue","scopus_rou.Art_No","scopus_rou.Page_start",
         "scopus_rou.Page_end","scopus_rou.Page_count","scopus_rou.Cited_by",
         "scopus_rou.Link","scopus_rou.Affiliations",
         "scopus_rou.Authors_with_affiliations","scopus_rou.Abstract",
         "scopus_rou.Author_Keywords","scopus_rou.Index_Keywords",
         "scopus_rou.Molecular_Sequence_Numbers","scopus_rou.Chemicals_CAS",
         "scopus_rou.Tradenames","scopus_rou.Manufacturers",
         "scopus_rou.Funding_Details","scopus_rou.Refs",
         "scopus_rou.Correspondence_Address","scopus_rou.Editors",
         "scopus_rou.Sponsors","scopus_rou.Publisher",
         "scopus_rou.Conference_name","scopus_rou.Conference_date",
         "scopus_rou.Conference_location","scopus_rou.Conference_code",
         "scopus_rou.ISSN","scopus_rou.ISBN","scopus_rou.CODEN",
         "scopus_rou.DOI","scopus_rou.Pubmed_ID","scopus_rou.Language",
         "scopus_rou.Abbreviated_Source_Title","scopus_rou.Document_Type",
         "scopus_rou.Source"]

maksimum = { "scopus_rou.id":0,"scopus_rou.Authors":0,"scopus_rou.Title":0,
         "scopus_rou.Year":0,"scopus_rou.Source_title":0,"scopus_rou.Volume":0,
         "scopus_rou.Issue":0,"scopus_rou.Art_No":0,"scopus_rou.Page_start":0,
         "scopus_rou.Page_end":0,"scopus_rou.Page_count":0,"scopus_rou.Cited_by":0,
         "scopus_rou.Link":0,"scopus_rou.Affiliations":0,
         "scopus_rou.Authors_with_affiliations":0,"scopus_rou.Abstract":0,
         "scopus_rou.Author_Keywords":0,"scopus_rou.Index_Keywords":0,
         "scopus_rou.Molecular_Sequence_Numbers":0,"scopus_rou.Chemicals_CAS":0,
         "scopus_rou.Tradenames":0,"scopus_rou.Manufacturers":0,
         "scopus_rou.Funding_Details":0,"scopus_rou.Refs":0,
         "scopus_rou.Correspondence_Address":0,"scopus_rou.Editors":0,
         "scopus_rou.Sponsors":0,"scopus_rou.Publisher":0,
         "scopus_rou.Conference_name":0,"scopus_rou.Conference_date":0,
         "scopus_rou.Conference_location":0,"scopus_rou.Conference_code":0,
         "scopus_rou.ISSN":0,"scopus_rou.ISBN":0,"scopus_rou.CODEN":0,
         "scopus_rou.DOI":0,"scopus_rou.Pubmed_ID":0,"scopus_rou.Language":0,
         "scopus_rou.Abbreviated_Source_Title":0,"scopus_rou.Document_Type":0,
         "scopus_rou.Source":0}
ry = 0
try:
    for row in reader:
        ry = ry + 1
        for k in  reader.fieldnames:
            try:
                lengte = len(row[k].strip())
            except:
                lengte = 0
            if k in maksimum:
                if lengte > maksimum[k]:
                    maksimum[k]= lengte
                else:
                    maksimum[k] = lengte
        print maksimum
except:
    pass

for l in maksimum.keys:
    print ("%s: %d\n" % (l, maksimum(l)))

Regards
Johann
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Samuel de Champlain | 1 Feb 08:48 2010
Picon

Re: python and sqlite

Thank you. I will read it next.
Here is another short one that I found:
http://www.wdvl.com/Authoring/python/SQLite/Watts07162009.html
If anyone knows of other tutorials on python and sqlite, please tell me of them.


On Sun, Jan 31, 2010 at 11:08 PM, Victoria Wood <cabbagetreecustard <at> gmail.com> wrote:
Hi, I am very new to Python myself and decided to use sqlite so I could learn about gui programming. Although it has a lot of adverts on and is short I found this tutorial very useful

http://www.devshed.com/c/a/Python/Using-SQLite-in-Python/

I hope I have replied to this correctly.

Victoria

On Sun, Jan 31, 2010 at 11:03 AM, Samuel de Champlain <
samueldechamplain <at> gmail.com> wrote:

> My project is relatively light and postgresql or mysql might be overkill.
> Does python work well with sqlite?
> If so, can you point me towards the proper libraries and manuals/tutorials?
> Thanks.
>
> ______________________________
_________________
> Tutor maillist  -  Tutor <at> python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Alan Gauld | 1 Feb 09:34 2010

Re: python and sqlite


"Samuel de Champlain" <samueldechamplain <at> gmail.com> wrote

> Here is another short one that I found:
> http://www.wdvl.com/Authoring/python/SQLite/Watts07162009.html
> If anyone knows of other tutorials on python and sqlite, please tell me 
> of
> them.

The databases topic in my tutorial uses SQLite as its database engine.
(Only in the v2 tutor so far)
--

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

spir | 1 Feb 10:57 2010
Picon

Re: parse text file

On Mon, 1 Feb 2010 00:43:59 +0100
Norman Khine <norman <at> khine.net> wrote:

> but this does not take into account of data which has negative values

just add \-? in front of \d+

Denis
________________________________

la vita e estrany

http://spir.wikidot.com/
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Norman Khine | 1 Feb 12:29 2010
Picon

Re: parse text file

On Mon, Feb 1, 2010 at 10:57 AM, spir <denis.spir <at> free.fr> wrote:
> On Mon, 1 Feb 2010 00:43:59 +0100
> Norman Khine <norman <at> khine.net> wrote:
>
>> but this does not take into account of data which has negative values
>
> just add \-? in front of \d+

thanks, what about the whitespace problem?

>
> Denis
> ________________________________
>
> la vita e estrany
>
> http://spir.wikidot.com/
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

--

-- 
%>>> "".join( [ {'*':' <at> ','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

#DENG JUN# | 1 Feb 09:46 2010
Picon

One question related to installation of Spyder

To those it may concern:

 

Hi, I got a problem with installing Spyder. By the way, my desktop is of windows system. I know that before installing Spyder, I first have to equip my computer with PyQt4.x(x>=4), QScintilla (x>=1) and Python2.5 (and upper). Do you have any release of QScintilla in .exe form? I failed to find the detailed instruction about how to install with the source file.

 

Best,

DENG JUN

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Kent Johnson | 1 Feb 13:19 2010
Picon

Re: parse text file

On Mon, Feb 1, 2010 at 6:29 AM, Norman Khine <norman <at> khine.net> wrote:

> thanks, what about the whitespace problem?

\s* will match any amount of whitespace includin newlines.

Kent
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Gmane