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
I left the "subject" above to be the same, as requested.
The actual subject might have been "Pythonic variable name use"
Alan says he had a challenge evaluating code (below) because the same
variable names were reused and it made me wonder if the python community has
general ideas about name re-u
Hello all!
My name is nate, and I am relatively new to this list, relatively being
just signed up.
I have a question that you would think would be obvious, but alas I have
struggled to figure out.
How do I play sound files in python.
More specificly, I want to play ogg files especially, with
On 07/12/2018 07:58, Sunil Tech wrote:
> 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
> ".
How do you define "specia
Hi Alan,
I am using Python 2.7.8
>>> tx = "MOUNTAIN VIEW WOMEN’S HEALTH CLINIC"
>>> tx.decode()
Traceback (most recent call last):
File "", line 1, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19:
ordinal not in range(128)
How to know whether in a given string(senten
On 07/12/2018 08:36, Sunil Tech wrote:
> I am using Python 2.7.8
tx = "MOUNTAIN VIEW WOMEN’S HEALTH CLINIC"
tx.decode()
> Traceback (most recent call last):
> File "", line 1, in
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19:
> ordinal not in range(128)
>
On Fri, Dec 07, 2018 at 01:28:18PM +0530, Sunil Tech wrote:
> Hi Tutor,
>
> I have a trouble with dealing with special characters in Python
There are no special characters in Python. There are only Unicode
characters. All characters are Unicode, including those which are also
ASCII.
Start her
On Fri, Dec 07, 2018 at 02:06:16PM +0530, Sunil Tech wrote:
> Hi Alan,
>
> I am using Python 2.7.8
That is important information.
Python 2 unfortunately predates Unicode, and when it was added some bad
decisions were made. For example, we can write this in Python 2:
>>> txt = "abcπ"
but it is
On Fri, Dec 07, 2018 at 02:17:55AM +, nathan tech wrote:
> Hello all!
>
> My name is nate, and I am relatively new to this list, relatively being
> just signed up.
>
> I have a question that you would think would be obvious, but alas I have
> struggled to figure out.
>
> How do I play soun
On Thu, Dec 06, 2018 at 09:13:01PM -0500, Avi Gross wrote:
> But so much code I see in python does not only reuse the same variable names
> but in a confusing way.
>
> file = "some name"
> file = open(file, "r")
> file = some_wrapper(file)
I agree this is confusing: you have the same name, "fil
On 12/7/18 3:20 AM, Steven D'Aprano wrote:
>> How to know whether in a given string(sentence) is there any that is not
>> ASCII character and how to replace?
>
> That's usually the wrong solution. That's like saying, "My program can't
> add numbers greater than 100. How do I tell if a number is
Hi All ,
I would like to unzip a file using python and then execute the sql
scripts in the file on Oracle database .
>>> from zipfile import ZipFile
>>> file_name = 'file.zip'
>>> z = ZipFile(file_name)
>>> print(z.namelist())
[]
>>> z = ZipFile('file.zip')
>>> print z.namelist()
[]
>>
[[ Real SUBJECT: emulating decorators ]]
Steven,
I am not suggesting that a particular way of reusing a name is a good idea.
I am asking if some ways are encouraged and others are discouraged in the
python community.
Just to clarify one point you asked about:
# > I have often seen something l
On 07/12/2018 02:13, Avi Gross wrote:
> Alan says he had a challenge evaluating code (below) because the same
> variable names were reused
It wasn't the reuse per se but the generic nature of
the names combined with reuse. Reusing names like
i,j,k for simple integer indices etc is not a problem.
On 07/12/2018 14:00, Asad wrote:
> Hi All ,
>
> I would like to unzip a file using python and then execute the sql
> scripts in the file on Oracle database .
Are you absolutely sure?
That's a very dangerous thing to do from a
security point of view. Potentially similar
to using exec() o
On Fri, Dec 07, 2018 at 05:59:22PM +, Alan Gauld via Tutor wrote:
[...]
> > ... In languages without garbage collection, reusing
> > the same name, like "index" repeatedly might save some
> > small amount of space.
>
> Garbage collection only helps if the variable loses
> its assignment. If
On Fri, Dec 07, 2018 at 12:30:18PM -0500, Avi Gross wrote:
> # > I have often seen something like this done with methods, such as to
> # > emulate decorator functionality where a method is created in an
> # > object with a name
> # > and the very next method created has the same name with the
17 matches
Mail list logo