Hi Tutor,
Is there any way that I can actually programmatically compare the file
extension with its content?
This is because we can manually save the file in one extension and later
rename the file extension to some other.
Thanks
- Sunil. G
___
Tutor m
in range(128)
How to know whether in a given string(sentence) is there any that is not
ASCII character and how to replace?
On Fri, Dec 7, 2018 at 2:01 PM Alan Gauld via Tutor
wrote:
> On 07/12/2018 07:58, Sunil Tech wrote:
>
> > I have a trouble with dealing with special characters in Pyt
Hi Tutor,
I have a trouble with dealing with special characters in Python Below is
the sentence with a special character(apostrophe) "MOUNTAIN VIEW WOMEN’S
HEALTH CLINIC" with actually should be "MOUNTAIN VIEW WOMEN'S HEALTH CLINIC
".
Please help, how to identify these kinds of special characters
Hi Team,
I am investigating how the memory allocation happens in Python
For Eg:
*Case 1:*
>>> a = 10
>>> b = 10
>>> c = 10
>>> id(a), id(b), id(c)
(140621897573616, 140621897573616, 140621897573616)
>>> a += 1
>>> id(a)
140621897573592
*Case 2:*
>>> x = 500
>>> y = 500
>>> id(x)
4338740848
>>>
Thank you Steven D'Aprano and Alan Gauld.
On Mon, Dec 26, 2016 at 4:41 PM, Alan Gauld via Tutor
wrote:
> On 26/12/16 08:03, Sunil Tech wrote:
> > Hi Team,
> >
> > Dictionary is like
> >
> > a = {'a': 'New', 'b':
Can this be achievable in one liner?
On Mon, Dec 26, 2016 at 1:33 PM, Sunil Tech wrote:
>
> Hi Team,
>
> Dictionary is like
>
> a = {'a': 'New', 'b': 'Two', 'l': [{'k': 'test', 'm': 'a
Hi Team,
Dictionary is like
a = {'a': 'New', 'b': 'Two', 'l': [{'k': 'test', 'm': 'again'}, {'k':
'test', 'm': 'again'}]}
I am trying to modify a value in the dictionary value at a['l'] & at 'm'
expecting it to be
a = {'a': 'New', 'b': 'Two', 'l': [{'k': 'test', 'm': 'replaced'}, {'k':
'test',
My heartly thanks to Steven D'Aprano, Alan Gauld and Peter Otten
for addressing this.
I would go with Steven D'Aprano
point
and will take Alan Gauld inputs.
Thanks once again.
On Mon, Dec 21, 2015 at 9:56 PM, Alan Gauld
wrote:
> On 21/12/15 12:22, Sunil Tech wrote:
>
Hi,
I Have a code..
class OptIf(object):
"""docstring for OptIf"""
def opt_me(self, ext):
if ext == 'CM':
rec = self.call_cm(cm, ad)
if ext == 'MM':
rec = self.call_mm(mm, ax)
if ext == 'DM':
rec = self.call_dm(dm, md)
Oh!
Thank you so much Steven for the reply.
On Thu, Dec 17, 2015 at 7:03 PM, Steven D'Aprano
wrote:
> On Thu, Dec 17, 2015 at 05:18:26PM +0530, Sunil Tech wrote:
> > Hi Tutor,
> >
> > I am searching for any magic method/or any method that calls on every
> &
Hi Tutor,
I am searching for any magic method/or any method that calls on every
calling of the Class methods.
for example:
Class A(object):
def one(self):
return
def two(self):
return
I need a method that prints which method is called in this class.
I am aware of __call
Thanks I got it.
class Cain(Adam):
"""docstring for Cain"""
def __init__(self, age, *args):
super(Cain, self).__init__(*args)
self.age = age
a = Adam('Eve')
c = Cain(12, 'Eve')
print a.name, c.age, c.name
>>>
class Adam(object):
"""docstring for Adam"""
def __init__(self, name):
self.name = name
class Cain(Adam):
"""docstring for Cain"""
def __init__(self, age, *args):
super(Cain, self).__init__(age, *args)
self.age = age
a = Adam('Eve')
c = Cain(12)
print a.n
Hi Tutor,
[a,b,c] = [1,2]
this will give
Traceback (most recent call last):
File "", line 1, in
ValueError: need more than 2 values to unpack
But is there any chance, if there are 3 values on left hand side and 2
values on right side, to add an empty value to the left side dynamically?
there
Thanks Alan Gauld
On Mon, Jun 8, 2015 at 9:27 PM, Alan Gauld
wrote:
> On 08/06/15 10:34, Sunil Tech wrote:
>
> what is the standard way of using docstrings?
>>
>
> As Steven said there are several "standards".
>
> Yet another option is to use the format re
Thank you Steven D'Aprano
On Mon, Jun 8, 2015 at 4:04 PM, Steven D'Aprano wrote:
> On Mon, Jun 08, 2015 at 03:04:05PM +0530, Sunil Tech wrote:
> > Hi Team,
> >
> > what is the standard way of using docstrings?
>
> There isn't one standard way
Hi Team,
what is the standard way of using docstrings?
for example (Sphinx)
def test(x):
"""
A dummy method
Args:
x (int): first argument
Returns:
"true or false"
"""
and if the method has no arguments?
how should be the docstring?
Thanks & Regards,
Sunil. G
Thank you for all your replies
On Wed, Jan 28, 2015 at 4:56 PM, Steven D'Aprano
wrote:
> On Wed, Jan 28, 2015 at 03:05:58PM +0530, Sunil Tech wrote:
> > Hi All,
> >
> > When i copied a text from web and pasted in the python-terminal, it
> > automatically
Hi All,
When i copied a text from web and pasted in the python-terminal, it
automatically coverted into unicode(i suppose)
can anyone tell me how it does?
Eg:
>>> p = "你好"
>>> p
'\xe4\xbd\xa0\xe5\xa5\xbd'
>>> o = 'ªîV'
>>> o
'\xc2\xaa\xc3\xaeV'
>>>
___
Thank you Alan for explanation
That's what the bit inside the loop does.
> It checks whether the input string is a digit (specifically a decimal
> digit).
> If it is a digit it returns the result as an integer
> otherwise it spits out an error and goes round the loop again.
>
_
Thank you Dave
On Wed, Nov 26, 2014 at 5:23 PM, Dave Angel wrote:
>
>
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
wrote:
> On 26/11/14 09:57, Sunil Tech wrote:
>
>> Hi Danny,
>>
>> Curious to the use the need of using while True in the given example of
>> ask_for_a_digit().
>>
>>
>> On Mon, Nov 17, 2014 at 9:57 AM, Danny Yoo > <mailto:d...@hash
Hi,
If you don't need.
You can anytime simply go to the link which is mentioned (as a footer in
the email) and unsubscribe.
rather posting this message to the tutor.
On Wed, Nov 26, 2014 at 2:59 PM, moemedi baboile <
moemedibabo...@yahoo.com.dmarc.invalid> wrote:
> I want thank you guys for help
Hi Danny,
Curious to the use the need of using while True in the given example of
ask_for_a_digit().
On Mon, Nov 17, 2014 at 9:57 AM, Danny Yoo wrote:
> > def ask_for_a_digit():
> > while True:
> > digit = raw_input("Give me a digit between 0 and 9.")
> > if digit not in "0
Thank you Peter Otten,
actually i should study about the collections and defaultdict like how and
where these can be used and its advantage.
On Fri, Sep 19, 2014 at 5:59 PM, Peter Otten <__pete...@web.de> wrote:
> Sunil Tech wrote:
>
> > Danny i did it like this
&
Danny i did it like this
result_dict = {}
for i in tes:
if i['a'] in result_dict:
temp = result_dict[i['a']]
temp['b'].append(i['b'])
temp['c'].append(i['c'])
temp['a'] = i['a']
result_dict[i['a']] = temp
else:
result_dict[i['a']] = {
Danny,
i wrote a method called *merge *below
can you be little clear with an example
I wrote something like this
ids = []
for i in tes:
if i['a'] not in ids:
ids.append(i['a'])
print ids
def merge(ids, tes):
for jj in ids:
txt = ''
for i in tes:
i
Hi all,
tes = [{'a': 1, 'b': 'this', 'c': 221},
{'a': 2, 'b': 'this', 'c': 215},
{'a': 1, 'b': 'is', 'c': 875},
{'a': 1, 'b': 'sentence', 'c': 874},
{'a': 2, 'b': 'another', 'c': 754},
{'a': 2, 'b': 'word', 'c': 745}]
The above one is the result form the DB. I
Thank you Danny and Joel :)
On Fri, Sep 12, 2014 at 9:51 PM, Joel Goldstick
wrote:
> On Fri, Sep 12, 2014 at 12:04 PM, Danny Yoo
> wrote:
> >
> >> i wrote a code like this
> >>
> >> for i in res:
> >> dict = {}
> >> dict['id_desc'] = str(i['id'])+','+str(i['description'])
>
> A minor re
Hi All,
i have a dictionary like
res = [{'description': 'Testo',
'id': '676',
'parentOf': True},
{'description': 'Pesto',
'id': '620',
'parentOf': False}]
i looking for the result like this
res = [{'description': 'Testo',
'id': '676',
'id_desc':'676_Testo',
'parentOf': True},
{'desc
Hey thanks Danny Yoo, Chris “Kwpolska” Warrick, D.V.N Sarma
.
I will take all your inputs.
Thanks a lot.
On Fri, Aug 15, 2014 at 3:32 AM, Danny Yoo wrote:
> On Thu, Aug 14, 2014 at 8:39 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ
> wrote:
> > I tested it on IDLE. It works.
>
>
> Hi Sarma,
>
>
> Followi
Hi,
I have string like
stmt = 'Patient name: Upadhyay Shyam Date of
birth: 08/08/1988 Issue(s) to be
analyzed: tesNurse Clinical summary: test1 Date of
injury: 12/14/2013Diagnoses: 723.4 - 300.02 - 298.3
- 780.50 - 724.4 Brachial neuritis or radiculitis nos - Generaliz
Hi,
I want to know how many sheets can be created in Excel using xlrd package.
Thank you
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
i have
{'extreme_fajita': [*{5: 4.0}*, *{6: 6.0}*],
'fancy_european_water': [*{5: 8.0}*, *{6: 5.0}*]}
if the keys of the dictionaries(bold & italic) are equal. I want to add
bold dict values, & italic dict values.
result should some thing like this
[{5:12.0},{6:11.5}]
i tried to do...
but ne
Hi Danny,
Thank you for replying..
I need the python program which takes the attached csv & on running the
program which will give me the results as
Data File data.csv
1, 4.00, burger
1, 8.00, tofu_log
2, 5.00, burger
2, 6.50, tofu_log
Program Input
program data.
yes Alan, what you said is true.
Thank you.
On Tue, Apr 15, 2014 at 1:40 PM, Alan Gauld wrote:
> On 15/04/14 07:06, Sunil Tech wrote:
>
>> Hi,
>>
>> #!/usr/bin/python
>>
>> import csv
>> import sys
>>
>> def main():
>>
Kindly assess the problem carefully including all the possibilities,
including but not limited to:
1. Menu directly available(1 item or all items).
2. Menu available but distributed over multiple items.
3. Menu need not be present in all restaurants listed.
4. Menu not available at all.
Ple
Please ignore previous email.
this error occurred as i had previously created .pyc file...
after deleting that .pyc file.. now it is working fine.
Thank you.
On Tue, Apr 15, 2014 at 11:36 AM, Sunil Tech wrote:
> Hi,
>
> #!/usr/bin/python
>
> import csv
> import sys
>
&
Hi,
#!/usr/bin/python
import csv
import sys
def main():
cr = csv.reader(open("data.csv","rb"))
for row in cr:
print row
if __name__ == "__main__":
sys.exit(main())
when i run this...
i get
Traceback (most recent call last):
File "data.py", line 14, in
sys.exit(ma
Hi Friends,
Is it possible to sort dict & to get result as dict?
if it is possible, please give some example.
Thank you in advance.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/li
Thank you Danny
On Mon, Nov 25, 2013 at 2:36 PM, Danny Yoo wrote:
> On Mon, Nov 25, 2013 at 12:31 AM, Sunil Tech
> wrote:
>
> I want to know, what difference is in between *mxDateTime & datetime of
>> python?*
>> looking for your comments...
>>
>
>
&g
I want to know, what difference is in between *mxDateTime & datetime of
python?*
looking for your comments...
Thank you in advance.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/lis
On Tuesday, July 23, 2013, Sunil Tech wrote:
> THANK YOU ALL for your time.
>
> The first format which I pasted was from the DB
>
> The second format(exactly the same), is to be sent to the view.
>
> If the logic can be fitted in One or two methods it'll help me to ea
21, 2013, Alan Gauld wrote:
> On 20/07/13 11:17, Sunil Tech wrote:
>>
>> Hi Everyone,
>>
>> I have a list of dictionaries like
>>
>> world =
>>
[{'continent':'Asia','continent_code':1,'ocean':'Pacific
Hi,
yes Dominik & the result should be in that format as stated.
On Sat, Jul 20, 2013 at 3:58 PM, Dominik George wrote:
> Hi,
>
> > world =
> >
> [{'continent':'Asia','continent_code':1,'ocean':'Pacific','country':'India','country_code':1,'state':'Kerala',
> > 'state_pin':51},
> > [...]
>
Hi Everyone,
I have a list of dictionaries like
world =
[{'continent':'Asia','continent_code':1,'ocean':'Pacific','country':'India','country_code':1,'state':'Kerala',
'state_pin':51},
{'continent':'Asia','continent_code':1,'ocean':'Pacific','country':'India','country_code':1,'state':'Karnat
Thank you Alan.
On Tue, Feb 19, 2013 at 2:44 PM, Alan Gauld wrote:
> On 19/02/13 07:30, Sunil Tech wrote:
>
>>
>> Here i request, can you tell me what is Query String with some examples?
>>
>
> It depends on the context but I suspect you mean in the context
Hi All,
I thank you all, for all the responses.
& teaching us to learn Python.
Here i request, can you tell me what is Query String with some examples?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.py
the Python grammar
> and semantics that stops you from doing that.
>
> So your question is better phrased as: if I don't explicitly return
> anything, what is returned?
>
> The answer to that would be: the None object
>
> Cheers,
> Kal
>
>
If a method has no return type?
what will it return?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Thanks all for your immediate responses :)
On Thu, Oct 11, 2012 at 6:20 PM, Joel Goldstick wrote:
> On Thu, Oct 11, 2012 at 8:30 AM, eryksun wrote:
> > On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech
> wrote:
> >>
> >> text1 contains
> >> This is from Text1
i used zip(), but it gives me result in list of tuples format.
But i don't get in a exact expect format (as mentioned)
no loopings are allowed.
On Thu, Oct 11, 2012 at 5:30 PM, Dave Angel wrote:
> On 10/11/2012 07:13 AM, Sunil Tech wrote:
> > Hi all,
> >
> > Greeting
Hi all,
Greetings to you...
it been so helpful for me to go through your all mails & support & i wish
it still continues.
I have two text files.
text1 contains
This is from Text1 --- 1st line
This is from Text1 --- 2nd line
This is from Text1 --- 3rd line
This is from Text1 --- 4th line
This is
*I am Beginner (very little i know), i want to know what are new things i
can find in Python.*
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
*Thank you all...*
*for your previous time. :)
*
On Sun, Dec 11, 2011 at 2:56 PM, Alan Gauld wrote:
> On 11/12/11 03:23, Lie Ryan wrote:
>
> If returning 'self' is the default expected behavior, it would cause
>> inconsistencies with respect to immutable types. For example, `5
>> .__add__(2)`, on
*hi,*
*
*
*Consider a list: a = [1,2,3]*
*
*
*& a simple function, which when called it will append 100 to the list.*
*
*
*def app(x):*
* return x.append(100)*
*
*
*p = app(a)*
*
*
*now list holds appended value [1,2,3,100]*
*but p is empty... why it is?*
*
*
*please teach.*
___
*Can i copy the content if a dictionary in to another variable, with out
any link between the dictionary & the variable?
if so, please teach.
*
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/
nd has all the usual Office applications...
>
> Search for 'OpenOffice' online.
>
>
> On Mon, Apr 11, 2011 at 9:48 PM, Alan Gauld wrote:
>
>>
>> "sunil tech" wrote
>>
>>
>> is there any way to convert any file (eg: document files
Hi all...
is there any way to convert any file (eg: document files & image files) to
.pdf?
if so, kindly share...
thank you in advance.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailma
Hi all...
i have d=[{'qty':0.0},{'qty':0.0}]
when all the qty is 0.0,
i want to perform some print operation
(only at once, after it checks everything in the list of dictionary 'd')...
if its not 0.0,
print some message...
Thank you in advance
___
Tut
60 matches
Mail list logo