How python implements php's global variables

小云云
Release: 2023-03-22 21:02:02
Original
1406 people have browsed it


This article mainly shares with you how to implement global variables in php in python, I hope it can help you.

1 Implement the data structure GlobalMap
2 Data storage

from GlobalMap import GlobalMap as gmgm = gm()
gm.set_map('hosts_up',hosts_up)
Copy after login

3 Data retrieval

from GlobalMap import GlobalMap as gmgm = gm()
hosts_up = gm.map.get('hosts_up')
Copy after login

4 Use

to store the data in the html file Use the variable hosts_up

Note: Python's global variables are not the same as PHP's.

Related recommendations:

PHP basic notes function global variable_PHP tutorial

The above is the detailed content of How python implements php's global variables. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!