\newcommand{\test}[2]{%
\begin{itemize}
\pyc{strs = u"#1".split(u"#2");}
\pyc{for s in strs: print("\item " + s);}
\end{itemize}
}
When using this command, I get the folowing output:
perhaps missing \item.
MWE:
\documentclass[a5paper]{extbook}
\usepackage{geometry}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage[pyfuture=all]{pythontex}
\setmainlanguage{russian}
\setotherlanguage{english}
\defaultfontfeatures{Ligatures=TeX,Mapping=tex-text}
\setmainfont{Times New Roman}
\newcommand{\test}[2]{%
\begin{itemize}
\pyc{strs = u"#1".split(u"#2");}
\pyc{for s in strs: print("\item " + s);}
\end{itemize}
}
\begin{document}
\test{test1, test2, test3, тест4}{,}
\end{document}

\begin{itemize}and\end{itemize}from Python as well, so that the entire command contents comes from Python, and you don't end up with only parts of it existing. – G. Poore Mar 25 '17 at 15:15