[Tutor] install python without root access

2016-03-22 Thread Anshu Kumar
Hi, I have a Centos06 based machine and I don't have root access. The default Python (GCC compiler based) is quite old 2.7.5 , so I need to update it. I tried installing in local folder where i have access. I am facing deep troubles installing 1. as i try to run ./configure i face configure: err

[Tutor] mock file reader object

2016-02-11 Thread Anshu Kumar
Hi, I need to mock file reader object , i tried using @patch('__builtin__.open') but it will patch my all file open readers. More precisely i have code something like below def restore_segments_and_lines_json(segments_file_path,lines_file_path,deleted_segment_ids): with open(segments_file_p

Re: [Tutor] Simultaneous read and write on file

2016-01-19 Thread Anshu Kumar
Hello All, So much Thanks for your response. Here is my actual scenario. I have a csv file and it would already be present. I need to read and remove some rows based on some logic. I have written earlier two separate file opens which I think was nice and clean. actual code: with open(file_path,

Re: [Tutor] An Advice to a dedicated beginner

2016-01-19 Thread Anshu Kumar
Hey, This sounds very usual and common. Your next step should be something that fetches you feedback like go for job/ internship or participate in coding contests. Try to look for some small projects on github. Most importantly never loose zeal it will take you there. Good luck Anshu On Jan

[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 open('test

Re: [Tutor] Python String and Unicode data types and Encode Decode Functions

2015-12-21 Thread Anshu Kumar
, Anshu On Sun, Dec 20, 2015 at 3:55 PM, Steven D'Aprano wrote: > On Sun, Dec 20, 2015 at 08:17:21AM +0530, Anshu Kumar wrote: > > > I know certain facts like > > What version of Python are you using? My *guess* is that you are using > Python 2.7, is that correct? >

[Tutor] Python String and Unicode data types and Encode Decode Functions

2015-12-20 Thread Anshu Kumar
Hi Everyone, In my current project I am dealing a lot with unicode type. There are some text files which contain unicode to accommodate data in multiple languages. I have to continuously parse these files in xml or yaml format using xml and yaml libraries. I have encountered several errors due to

Re: [Tutor] Demystification of Lambda Functions

2015-10-28 Thread Anshu Kumar
Hi, Lambda or anonymous function is core of functional programming which was not in java. With lambda you can pass not just define an anonymous function but can pass them to other functions which really makes life easier. You would like to read http://www.python-course.eu/lambda.php http://www.p

[Tutor] python certifications

2015-10-11 Thread Anshu Kumar
Hi All, I have been using python for a year now and want to certify my skill. May I know what are the certifications for python? Thanks and Regards, Anshu ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://ma

Re: [Tutor] Updating index of a list

2015-10-09 Thread Anshu Kumar
Hi Andrea, You can use lambda or list comprehension to solve your problem in one step. I am more comfortable with lambda so will explain that way. Please follow below lines of code. andreea_list = [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', '99']] andrea

Re: [Tutor] Mutable data type in python

2015-10-03 Thread Anshu Kumar
her data structure in python which would be mutable and not a sequence? Thanks and appreciate your generous help, Anshu On Sat, Oct 3, 2015 at 1:32 PM, Alan Gauld wrote: > On 03/10/15 03:46, Anshu Kumar wrote: > >> Hi Alan, >> >> I was trying to solve a simple dynamic pr

Re: [Tutor] Mutable data type in python

2015-10-03 Thread Anshu Kumar
ciate your help, Anshu On Sat, Oct 3, 2015 at 5:05 AM, Alan Gauld wrote: > On 02/10/15 17:52, Anshu Kumar wrote: > > When we invoke the same function inside a function (recursive function), i >> want to keep track of some data across all function invocation so i should >> h

[Tutor] Mutable data type in python

2015-10-02 Thread Anshu Kumar
Hi Everyone, I have been facing this problem from a while in python could I please be helped? When we invoke the same function inside a function (recursive function), i want to keep track of some data across all function invocation so i should have shareable type but built in data types string, i