Thanks to everyone who responded on this thread, your time is greatly
appreciated.
It appears however that my problem is related to the environment. I
sent my original email right before leaving work and have since been
working on a physical machine without any problems. I've copied some
of that c
> The name of the file I'm trying to open comes from a UTF-16 encoded text file,
> I'm then using regex to extract the string (filename) I need to open. However,
> all the examples I've been using here are just typed into the python console,
> meaning string source at this stage is largely irreleva
On Thu, Jun 28, 2012 at 3:48 PM, James Chapman wrote:
> Informative thanks Jerry, however I'm not out of the woods yet.
>
>
>> Here's a couple of questions that you'll need to answer 'Yes' to
>> before you're going to get this to work reliably:
>>
>> Are you familiar with the differences between b
On 28/06/2012 20:48, James Chapman wrote:
The name of the file I'm trying to open comes from a UTF-16 encoded
text file, I'm then using regex to extract the string (filename) I
need to open.
OK. Let's focus on that. For the moment -- although it might
well be very relevant -- I'm going to igno
Informative thanks Jerry, however I'm not out of the woods yet.
> Here's a couple of questions that you'll need to answer 'Yes' to
> before you're going to get this to work reliably:
>
> Are you familiar with the differences between byte strings and unicode
> strings?
I think so, although I'm
On Thu, Jun 28, 2012 at 2:55 PM, James Chapman wrote:
> Why can I not convert my existing byte string into a unicode string?
That would work fine.
> In the mean time I'll create my original string as unicode and see if that
> solves my problem.
>
fileName = unicode(filename)
>
> Traceback (
Why can I not convert my existing byte string into a unicode string?
In the mean time I'll create my original string as unicode and see if
that solves my problem.
>>> fileName = unicode(filename)
Traceback (most recent call last):
File "", line 1, in
UnicodeDecodeError: 'utf8' codec can't deco
On Thu, Jun 28, 2012 at 1:55 PM, James Chapman wrote:
> Thanks Tim, while this works, I need the name to be stored in a variable as
> it's dynamic.
>
> In other words, how do I rewrite
> open(u"blah£.txt")
>
> to be
> filename = "blah£.txt"
> open(filename)
You have to create a unicode-string, no
Thanks Tim, while this works, I need the name to be stored in a
variable as it's dynamic.
In other words, how do I rewrite
open(u"blah£.txt")
to be
filename = "blah£.txt"
open(filename)
At Thursday, 28/06/2012 on 18:39 Tim Golden wrote:
On 28/06/2012 18:19, James Chapman wrote:
> Hi there pyt
On 28/06/2012 18:19, James Chapman wrote:
Hi there python list.
I'm trying to open a text file named "This is_a-test'FILE to Ensure$
that£ stuff^ works.txt" (without the quotes) but I'm struggling to
find a way to open it.
Happily, you're using Windows, which makes this very much easier.
Shor
Hi there python list.
I'm trying to open a text file named "This is_a-test'FILE to Ensure$
that£ stuff^ works.txt" (without the quotes) but I'm struggling to
find a way to open it.
>>> filename = "This is_a-test'FILE to Ensure$ that£ stuff^
works.txt.js"
>>> open(filename)
Traceback (most recent
On 28/06/12 01:19, moheem ilyas wrote:
def tester():
fin = open('/home/moheem/Documents/words.txt', 'r')
value = 0
wordDict = dict()
for word in fin:
wordDict[word] = value
value = value + 1
fin.close()
There seems to be a logical error. That is, when
12 matches
Mail list logo