Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Variables Python variables     - Spring Boot + Nginx + Tomcat + SSL configuration notes (Server)

- LVM management parameters commonly used commands explained in detail (Linux)

- Linux security concerns again (Linux)

- Ubuntu 14.04 Enable root and disable the guest (Linux)

- Setting CentOS firewall open port (Linux)

- Understand ASP.NET 5 running the command: DNVM, DNX, and DNU (Server)

- Java Network Programming Internet address lookup (Programming)

- Java singleton mode (Singleton mode) (Programming)

- To_explore Linux system boot process (Linux)

- Effective Java - lazy initialization (Programming)

- Linux ps command (Linux)

- CentOS installation of the ftp (Linux)

- C # socket udp broadcast (Programming)

- How Bluetooth turned off by default in Ubuntu 14.04 (Linux)

- Linux kernel modules related to the management Comments (Linux)

- Linux crontab use (Linux)

- Advanced permissions Linux file system settings (Linux)

- Flow control message transmission between RAC (Database)

- GRUB how to load Linux kernel (Linux)

- Using Linux command line and execute PHP code (Programming)

  Variables Python variables
  Add Date : 2018-11-21      
  Recently wrote a program process of variables encountered a Python variable is the value of a variable, or variable, and then I want to take the final value, thanks to the great google, wrote this article under record. First on the code:

#! / Usr / bin / env python
# Encoding = utf-8

import inspect
import ConfigParser

confPath = "/ home / linuxidc / config / config"

def modify_config (domain_name, app_type, port, if_api, vip, svn, svnver, yfb_ip, cron_ip, hosts, hostname, if_cas_oa, if_session, if_nginx, check_apps_dir, health_check):
    if vip is None:
        vip = ""
    if yfb_ip is None:
        yfb_ip = ""
    if cron_ip is None:
        cron_ip = ""
    if hosts is None:
        hosts = ""
    if if_cas_oa is None:
        if_cas_oa = ""
    if if_session is None:
        if_session = ""
    # Updates the specified section, the value of the option
    conf = ConfigParser.ConfigParser ()
    conf.read (confPath)
    ### Inspect.getargspec this role is to take the function's parameter list
    arg_list = inspect.getargspec (modify_config) .args
    ### Following the second argument conf.set I just want to take arg value, and the third would like to take arg parameter value of a variable value, because the value of arg is itself a function of the parameters modify_config
    for arg in arg_list:
        conf.set ( "online", arg, locals (). get (arg))
    conf.write (open (confPath, "w"))

if __name__ == '__main__':
    domain_name = "www.linuxidc.com"
    app_type = "osp"
    port = "8081"
    if_api = "1"
    vip = ""
    svn = "https://svn.tools.linuxidc.com/svn/"
    svnver = "24562"
    yfb_ip = ""
    cron_ip = ""
    hosts = "www.linuxidc.com"
    hostname = "JD-linuxidc-COM"
    if_cas_oa = "0"
    if_session = "mcs2"
    if_nginx = "1"
    check_apps_dir = "0"
    health_check = "_health_check"
    modify_config (domain_name, app_type, port, if_api, vip, svn, svnver, yfb_ip, cron_ip, hosts, hostname, if_cas_oa, if_session, if_nginx, check_apps_dir, health_check)
- Server Security Analysis attack on Linux (Linux)
- Java recognize simple codes (Programming)
- Oracle to create an external table (Database)
- RHEL6 install Python and other packages from source (Linux)
- Performance Diagnosis of 60,000 milliseconds for Linux (Linux)
- Ubuntu 15.04 / CentOS 7.0 to set custom boot (Linux)
- Workaround CentOS error message during compilation PHP5 common (Linux)
- CentOS7 compile and install Tengine + PHP + MariaDB notes (Server)
- Nginx supports user multi-threaded downloads and resume broken (Server)
- Oracle archive log deletion (Database)
- Stucts2 values on the page and how the attribute values corresponding to the Action (Programming)
- Shell command line operation (Linux)
- Quickly build and install Linux KVM system (Linux)
- VirtualBox installation enhancements let the mouse move and share CentOS 6.4 (Linux)
- Nagios (centreon) monitoring LVS (Server)
- CentOS 6.4 of cron scheduled task configuration (Linux)
- How to fix the Ubuntu Error script returned error exit status 1 (Linux)
- Java Network Programming Internet address lookup (Programming)
- HBase vs Oracle (Database)
- Shell Scripting early experience (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.