Re: [Tutor] pandas data frame

2016-01-18 Thread Bachir Bachir via Tutor
 Hi Peter Thank you much for your help its very appreciated ,bellow is an example of what i need.   The main dataframe ( need to be separated into separate dataframes  ). The desired dataframes output correctly as i need it to be,Thanks much Main dataframendx     V_id        Average        Mean

[Tutor] Fwd:

2016-01-18 Thread Deepak Nn
-- Forwarded message -- From: Deepak Nn Date: Mon, Jan 18, 2016 at 6:27 PM Subject: Re: To: tutor-ow...@python.org Please provide a python program to run a program (.exe) and get Hash *exactly* as : 160 106 182 190 228 64 68 207 248 109 67 88 41

Re: [Tutor] str.strip strange result...?

2016-01-18 Thread Albert-Jan Roskam
> From: d...@hashcollision.org > Date: Mon, 18 Jan 2016 00:29:41 -0800 > Subject: Re: [Tutor] str.strip strange result...? > To: sjeik_ap...@hotmail.com > CC: __pete...@web.de; tutor@python.org > > > Not sure which one is faster, but in this case I actually find a regex more > > readable (!):

Re: [Tutor] str.strip strange result...?

2016-01-18 Thread Danny Yoo
> Not sure which one is faster, but in this case I actually find a regex more > readable (!): re.sub(r"_1$", "", "V01_1") > 'V01' Hi Albert-Jan Roskam, Here's a minor counterpoint to using regexes here: they're sometimes a bit too powerful. In this situation, a regex approach might be

Re: [Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

2016-01-18 Thread sudipto manna
Here is the code snippet: File#FlaskTest2.py from flask import Flask app = Flask(__name__) #Make an app.route() decorator here @app.route("/puppies/", methods = ['GET' , 'POST']) def puppiesFunction(): if request.method == 'GET': return getAllPuppies() elif request.method == 'POST':

Re: [Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

2016-01-18 Thread Danny Yoo
On Sun, Jan 17, 2016 at 6:13 PM, sudipto manna wrote: > Here is the code snippet: > > File#FlaskTest2.py > > from flask import Flask > > app = Flask(__name__) > > #Make an app.route() decorator here > @app.route("/puppies/", methods = ['GET' , 'POST']) > def

Re: [Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

2016-01-18 Thread Alan Gauld
On 18/01/16 02:13, sudipto manna wrote: > Here is the code snippet: > > File#FlaskTest2.py > > from flask import Flask > > app = Flask(__name__) > > #Make an app.route() decorator here > @app.route("/puppies/", methods = ['GET' , 'POST']) > def puppiesFunction(): > if request.method == 'GET': >

Re: [Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

2016-01-18 Thread Cameron Simpson
On 17Jan2016 20:13, sudipto manna wrote: Here is the code snippet: File#FlaskTest2.py from flask import Flask You need to import "request" from flask as well: from flask import Flask, request For others on this list: the Flask framework presents the current web

Re: [Tutor] pandas data frame

2016-01-18 Thread Peter Otten
Bachir Bachir wrote: [Bachir, please send your mails to the list, not to me. That way you increase the likelihood to get a good answer] >> On Sunday, January 17, 2016 4:20 PM, Peter Otten <__pete...@web.de> >> wrote: >> Bachir Bachir via Tutor wrote: >>> Hello EverybodyI need to sort a

Re: [Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

2016-01-18 Thread Danny Yoo
On Mon, Jan 18, 2016 at 7:59 AM, sudipto manna wrote: > Thanks All. > The import request was missing and the issue was resolved upon calling that > module and initializing it. Hi Sudipto Manna, One last thing before you go on. Do a small retrospective: now that you know

Re: [Tutor] Should a "data" directory have a __init__.py file?

2016-01-18 Thread Oscar Benjamin
On 18 January 2016 at 04:27, Ben Finney wrote: > > The module import system will only recognise a directory as a “package” > (Python's technical term for “a point in the import hierarchy which > contains other things to import”) if that directory contains a file >

Re: [Tutor] How (and whether I should) use pkgutil.get_data()?

2016-01-18 Thread Oscar Benjamin
On 17 January 2016 at 23:37, boB Stepp wrote: > 1) Is using pkgutil.get_data() the way I should be reading my data files? Generally yes, although it may be unnecessary. The main purpose of pkgutil.get_data is to transparently handle the case where your packages are

Re: [Tutor] if request.method == 'GET': NameError: global name 'request' is not defined

2016-01-18 Thread sudipto manna
Thanks All. The import request was missing and the issue was resolved upon calling that module and initializing it. Thanks for the guidance. Regards, Sudipto Manna On Mon, Jan 18, 2016 at 3:55 AM, Cameron Simpson wrote: > On 17Jan2016 20:13, sudipto manna

[Tutor] Password decoding (was Re: Fwd:)

2016-01-18 Thread Alan Gauld
On 18/01/16 13:06, Deepak Nn wrote: > Please provide a python program to run a program (.exe) and get Hash > *exactly* as : > > 160 106 182 190 228 64 68 207 248 109 67 88 41 .The username to be > used is admin > .The *password* is what to be found out .The hash provided is of the > correct

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Alan Gauld
On 18/01/16 16:01, Anshu Kumar wrote: > Hello Everyone, > > I try below code in python 2.7.10 to first create and write into a file and > then read and write that file but what i get is just a file with new > content. > > with open('test.txt', 'wb+') as f: > ... f.write('this is test

[Tutor] Simultaneous read and write on file

2016-01-18 Thread Anshu Kumar
Hello Everyone, I try below code in python 2.7.10 to first create and write into a file and then read and write that file but what i get is just a file with new content. >>> with open('test.txt', 'wb+') as f: ... f.write('this is test file.') ... f.write('ok!!!') ... >>> with

Re: [Tutor] Fwd:

2016-01-18 Thread Danny Yoo
> Please provide a python program to run a program (.exe) and get Hash > *exactly* as : > > 160 106 182 190 228 64 68 207 248 109 67 88 41 .The username to be > used is admin > .The *password* is what to be found out .The hash provided is of the > correct password .Mostly the password will be *13

Re: [Tutor] An Advice to a dedicated beginner

2016-01-18 Thread Alan Gauld
On 19/01/16 01:15, Michael Appiah Boachie wrote: > I am a programming beginner. ... > when i sat on my own with a couple of materials and videos, > I have become very good at the basics of python and > completing various beginner courses and projects with ease > but however I have run into some

[Tutor] An Advice to a dedicated beginner

2016-01-18 Thread Michael Appiah Boachie
Hello Tutors, I am a programming beginner. Throughout college, I have not properly grasp anything the professor’s teach but when i sat on my own with a couple of materials and videos, I have become very good at the basics of python and completing various beginner courses and projects with ease

Re: [Tutor] An Advice to a dedicated beginner

2016-01-18 Thread Ben Finney
Alan Gauld writes: > On 19/01/16 01:15, Michael Appiah Boachie wrote: > > I am a programming beginner. ... > > when i sat on my own with a couple of materials and videos, > > I have become very good at the basics of python and > > completing various beginner courses

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Martin A. Brown
Hello, >> I have read in documentation that wb+ mode is for writing and >> reading. Am i using wrong mode, should i use rb+ ? > >Use w+ to create a new file, opened with read and write access. Use >r+ to open an existing file with read and write access. Unlike w+, >r+ does not truncate the

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Cameron Simpson
On 18Jan2016 20:41, Martin A. Brown wrote: Yes and so have I. Maybe twice in 30 years of programming. [...] I may have done it a little more than that; I agree it is very rare. I may be biased because I was debugging exactly this last week. (Which itself is an argument

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Cameron Simpson
On 18Jan2016 21:07, ALAN GAULD wrote: On 18/01/16 20:43, Cameron Simpson wrote: The + modes are deceptively appealing but they are full of dangers for precisely the reasons you have discovered(*). You very rarely need them and you are better opening/closing the file

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Cameron Simpson
On 18Jan2016 22:29, Peter Otten <__pete...@web.de> wrote: Anshu Kumar wrote: I have read in documentation that wb+ mode is for writing and reading. Am i using wrong mode, should i use rb+ ? Quoting https://docs.python.org/2.7/library/functions.html#open """ note that 'w+' truncates the file.

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Martin A. Brown
Hi all, The + modes are deceptively appealing but they are full of dangers for precisely the reasons you have discovered(*). > >> Yes and so have I. Maybe twice in 30 years of programming. It's >> sometimes necessary but it's much, much harder to get right and >> very easy to get

[Tutor] Beautiful Soup

2016-01-18 Thread Crusier
Hi Python Tutors, I am currently able to strip down to the string I want. However, I have problems with the JSON script and I am not sure how to slice it into a dictionary. import urllib import json import requests from bs4 import BeautifulSoup url =

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread eryk sun
On Mon, Jan 18, 2016 at 10:04 PM, Martin A. Brown wrote: > The above is a very handy chart. Did you find this somewhere, eryk > sun, or is this from your own knowledge and experience? The mapping to POSIX open flags is from a table in the POSIX fopen spec [1] as well as the

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Peter Otten
Anshu Kumar wrote: > Hello Everyone, > > I try below code in python 2.7.10 to first create and write into a file > and > then read and write that file but what i get is just a file with new > content. > > with open('test.txt', 'wb+') as f: > ... f.write('this is test file.') > ...

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Alan Gauld
On 18/01/16 20:43, Cameron Simpson wrote: >> The + modes are deceptively appealing but they are full of dangers >> for precisely the reasons you have discovered(*). You very rarely >> need them and you are better opening/closing the file and >> using explicit modes to read/write. > > But if he

Re: [Tutor] pandas data frame

2016-01-18 Thread Peter Otten
Bachir Bachir via Tutor wrote: > Hi Peter Thank you much for your help its very appreciated ,bellow is an > example of what i need. The main dataframe ( need to be separated into > separate dataframes ). The desired dataframes output correctly as i need > it to be,Thanks much Main dataframendx

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread Cameron Simpson
On 18Jan2016 16:29, ALAN GAULD wrote: On 18/01/16 16:01, Anshu Kumar wrote: I try below code in python 2.7.10 to first create and write into a file and then read and write that file but what i get is just a file with new content. with open('test.txt', 'wb+') as

Re: [Tutor] Simultaneous read and write on file

2016-01-18 Thread eryk sun
On Mon, Jan 18, 2016 at 10:01 AM, Anshu Kumar wrote: > I have read in documentation that wb+ mode is for writing and reading. Am i > using wrong mode, should i use rb+ ? Use w+ to create a new file, opened with read and write access. Use r+ to open an existing file with