TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #191 · 14 дек.

Как разделить строку с shell-командой на отдельные аргументы в виде списка? Если сделать просто сплит по пробелу то получим то что надо, кроме случаев со вставками текста с пробелами. Например так: >>> '-arg "I Am Groot"'.split(' ') ['-arg', '"I', 'Am', 'Groot"'] Чтобы учитывать текст в кавычках как единый аргумент можно воспользоваться функцией shlex.split() Кто читает мой канал давно, уже в курсе. А что делать, если нужно обратное действие? Объединить аргументы из списка в строку и при этом добавить кавычки в аргумент с пробелами. Конечно, если вы используете subprocess то он сам всё разрулит. Но если вам нужна именно команда одной строкой, то можно воспользоваться готовой функцией в том же subprocess. >>> from subprocess import list2cmdline >>> list2cmdline(['-arg', 'I Am Groot']) '-arg "I Am Groot"' Он также позаботится об экранировании уже имеющихся кавычек >>> list2cmdline(['-arg', 'I Am "Groot"']) '-arg "I Am \"Groot\""' А вот так он может "схлопнуть" в команду JSON >>> list2cmdline(['--json', json.dumps({'key': 'value'})]) '--json "{\"key\": \"value\"}"' _______________ Возможно кто-то спросит, а зачем соединять аргументы в строку если subprocess сам это сделает а os.system не наш путь? Мне как-то потребовалось отправлять команду на удалённое выполнение и в API поддерживалось указание команды только строкой. Так что всякое бывает) #libs#basic

Hashtags

Резултати

Пронајдени 2 слични објави

Пребарај: #chinaai

当前筛选 #chinaai清除筛选
AI & Law

@ai_and_law · Post #59 · 18.07.2023 г., 07:04

China's new AI measures: boosting generative AI services Hello, everyone! Today we have exciting news from China. On July 13th China released the final version of the Interim Measures for Administration of Generative AI Services. Compared to the previous draft, which was open for public comments in April, the final version showcases a more business-friendly and supportive approach. These AI Measures specifically apply to services that generate text, image, video, and audio content using generative AI technology and are made available to the public in China. With a focus on both development and security, China adopts an "inclusive and prudent" stance. Notably, the final version includes more comprehensive provisions to foster international collaborations on generative AI technology and services, surpassing the scope of the earlier draft. The AI Measures outline a range of legal requirements for performing and utilizing generative AI services. These include adhering to core social values, protecting intellectual property rights and trade secrets, as well as taking effective measures to prevent discrimination, monopoly, and anticompetitive practices when designing algorithms, selecting training data, and creating computing models. While the whistle-blowing mechanism remains intact from the consultation draft, the punitive terms that could result in administrative fines of RMB10,000-100,000 for violations have been removed in the final AI Measures. The AI Measures are set to take effect on August 15th, sending a positive signal to businesses interested in investing, developing, and engaging in generative AI services in China. This move is expected to attract significant investments into China's thriving AI landscape in the coming months and years. #AIRegulations#GenerativeAI#ChinaAI#BusinessInvestments

Crypto M - Crypto News

@CryptoM · Post #64898 · 10.04.2026 г., 07:57

🚀 AI TRENDS | China's AI Industry Alliance Issues Risk Management Guide for Enterprise Security China's AI industry alliance has introduced a risk management guide aimed at enhancing enterprise security governance, similar to OpenClaw. According to NS3.AI, the guide establishes a security framework and self-inspection standards for the deployment, usage, and decommissioning of AI agents. #AI#ChinaAI#EnterpriseSecurity#RiskManagement#SecurityGovernance#AIIndustry#AIagents#NS3AI