NX-OSのBash・Guest ShellとPython12 / 13
日付文字列をfile名へ連結する
prefixと日付がどちらも文字列なら、+で連結する。次はdateを文字列として用意した例である。
date = "2026-11-05"
file_name = "fusion-config_" + date
print(file_name) # fusion-config_2026-11-05
引用符の中のdateは文字のままになる。変数の値を使う場合は引用符の外へ置く。
参考資料
- Cisco 350-601 v1.2 Exam Topics ↗
- NX-OS10.5 programmability ↗
- ncclient manager API ↗
- NX-OS NETCONF Agent 10.6 ↗
- Cisco POAP implementation and verification ↗
- NX-OS Linux shell tools ↗
- Python subprocess ↗
- Nexus Dashboard LAN Template Library 4.2.1 ↗
- Nexus Dashboard configuration policies 4.2.1 ↗
- NX-API CLI 10.6 ↗
- Cisco onbox-shell-python ↗
- Cisco technical documentation ↗
- Technical specification ↗
- Technical specification ↗
- Technical specification ↗
- Pythonの辞書 ↗
- NX-OS 10.5のGuest Shell ↗
- NX-OSのGuest Shell ↗
- NX-OSのGuest Shell ↗
- NX-OSのCLI module ↗
- Pythonのdict.update ↗
- Pythonの文字列結合 ↗
- RPMのupgrade option ↗