473,546 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Include File?

Hi
i am a totally python newcomer. Can i use
include files within python?

(like for example: include <xxx.py>)

Thanks for help in advance
Werner Hofer
Jul 18 '05 #1
4 50496
Whofer wrote:
i am a totally python newcomer. Can i use
include files within python?

(like for example: include <xxx.py>)

The python equivalent is

import xxx

#use it, assuming the doSomething() function is defined in module xxx:
xxx.doSomething ()

If you already know a programming language, the tutorial that comes with the
python distribution is a good starting point to learn the language.
Good luck!

Peter
Jul 18 '05 #2
Whofer wrote:

i am a totally python newcomer. Can i use
include files within python?

(like for example: include <xxx.py>)


Have you gone through the several tutorials and web pages for newcomers?

Questions like this should be adequately covered in them, so it would
be surprising if you've read them yet still don't know about "import".

-Peter
Jul 18 '05 #3
Cam
I am not so new and I still dont know if its possible.
I 2nd that question.

Whofer wrote:
Hi
i am a totally python newcomer. Can i use
include files within python?

(like for example: include <xxx.py>)

Thanks for help in advance
Werner Hofer


Jul 18 '05 #4
Cam <no************ **********@paci fic.net.au> writes:
I am not so new and I still dont know if its possible.
I 2nd that question.

Whofer wrote:
Hi
i am a totally python newcomer. Can i use
include files within python?
(like for example: include <xxx.py>)
Thanks for help in advance
Werner Hofer


There is no raw-file include (as in C's cpp) in the Python language.
(Of course, you could use #include and run cpp on the file
before passing it to Python.)

The Pythonic way to do this is "import". Unlike cpp, the imported
file must be a valid python module in its own right, though it can be
pretty simplistic. E.g., you could just define a list.

--
ha************@ boeing.com
6-6M31 Knowledge Management
Phone: (425) 342-5601
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3590
by: middletree | last post by:
I have a page which, according to the boss's instructions, needs to show one of two things, based on which radio button was chosen on the previous page. Because these 'things' are actually some chunks of code which contain sql queries, loops, etc., I think it might be best to put each of them into an include. Will this work: <%If...
7
4025
by: Vojma | last post by:
I have a problem At my site I have designed a framework with tabs as below (tabs_1.asp) +----+ +------+ +-------+ | MC | | Cars | | Boats | + +------------------------- then, into tabs_1.asp I include another page
9
9410
by: JR | last post by:
Hi, I'm migrating my website to an IIS 6.0 server and all the asp pages work fine except for the ones that reference include files, even though I have "Enable parent paths" enabled in the App/Options tab. The include files are being called as <!-- #include virtual="../includes/file.inc" --> <!-- #include virtual="../includes/script.asp"...
6
1641
by: qaz | last post by:
I run a web site on both a testing server and a "production" server. I noticed that references to the include file do not work on the testing server but they do work on the production server. I have to change all references like this: <!--#INCLUDE VIRTUAL="include/conndb.asp"--> to references like this: <!--#INCLUDE...
9
2987
by: Sarath | last post by:
I am working with an application using ASP, getting below error when i am trying to include new asp include file. _____________________________________________________________________ Microsoft VBScript runtime error '800a0006' Overflow: '' ____________________________________________________________________ I am sure that there is no...
10
2514
by: Toke H?iland-J?rgensen | last post by:
Hello. I am quite new to the c++ language, and am still trying to learn it. I recently discovered how using include files would allow me to split up my code into smaller segments, instead of having class definitions etc. in one big file (yay, major discovery...). My problem is this: When I define a class in one include file, and then try...
10
25367
by: vunet.us | last post by:
What is the workaround of passign a parameter to any included asp file: <!-- #Include File="file.asp" --> This obviously does not work: <!-- #Include File="file.asp?id=123" --> Thank you
1
11306
by: armando | last post by:
Hi, I'm working on a web site devolepped in asp and this site work with the incusion in the page asp <td id="Colonna lato sinistro" width="200px" valign="top" style="height: 19px"> <!--#include file="Include/colonna_sx_ecomm.asp"!--> </td> in the colonna_sx_ecomm.asp there is:
14
3125
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an...
10
1937
by: Raheem | last post by:
Hello, I built a development version of a live website on my hosted account. However the development version is having problems with finding include files. After troubleshooting I was able to resolve the issue by removing the ../ from the beginning of the include file path. But now I am looking at making this modification hundreds of times...
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7794
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.