placid wrote:
> Hi all,
>
> How do i import a module that has an hypen/dash (-) in its name ? I get
> a SytaxError exception
You can use function __import__.
>>> print open("-test.py").read()
def fun2():
return "Hello from -test !"
>>> import -test
File "", line 1
import -test
placid wrote:
> Hi all,
>
> How do i import a module that has an hypen/dash (-) in its name ? I get
> a SytaxError exception
>
> Cheers
>
>
You can't do that directly. However, the internals of the import
mechanism are available to the programmer through a module named imp. It
allows you to im
Hi all,
How do i import a module that has an hypen/dash (-) in its name ? I get
a SytaxError exception
Cheers
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
> On 10 Apr 2006 20:55:31 -0700, "placid" <[EMAIL PROTECTED]> declaimed the
> following in comp.lang.python:
>
>
> >
> > Traceback (most recent call last):
> > File "LinkedList.py", line 7, in ?
> > main()
> > File "LinkedList.py", line 4, in main
> > n = Node
so there is a record of this problem i had, to solve this problem
either use
import node
.
.
.
n = node.Node("test")
or
from node import *
.
.
.
n = Node("test")
Cheers
--
http://mail.python.org/mailman/listinfo/python-list
Scott David Daniels wrote:
> placid wrote:
> > I have the following class code for a Node for a Linked List, (saved in
> > node.py)
> >
> > class Node :
> > def __init__(self,element):
> >self.element = element
> >self.next = None
> >
> > then i have another module called Link
placid wrote:
> I have the following class code for a Node for a Linked List, (saved in
> node.py)
>
> class Node :
> def __init__(self,element):
>self.element = element
>self.next = None
>
> then i have another module called LinkedList.py, with following code
>
> import sys
Hi all,
I have the following class code for a Node for a Linked List, (saved in
node.py)
class Node :
def __init__(self,element):
self.element = element
self.next = None
then i have another module called LinkedList.py, with following code
import sys
import node
def main():
On 7/7/2005 5:50 PM, GregM wrote:
> A search on google for odbchelper resulted in:
> http://linux.duke.edu/~mstenner/free-docs/diveintopython-3.9-1/py/odbchelper.py
>
> I think this will help you.
> Greg.
>
That is the previous example which worked for me fine. I have this code
on a network dr
A search on google for odbchelper resulted in:
http://linux.duke.edu/~mstenner/free-docs/diveintopython-3.9-1/py/odbchelper.py
I think this will help you.
Greg.
--
http://mail.python.org/mailman/listinfo/python-list
Hi
I am trying to learn Python with the "Dive Into Python" book coming from
VB, but am getting stuck at Example 2.3
(http://www.diveintopython.org/getting_to_know_python/everything_is_an_object.html).
Here is what I get following the book's directions for:
>>> import odbchelper
Traceback
11 matches
Mail list logo