python请求 - 使用相同的键发布多个值,并结合常规键

时间:2016-04-02 11:02:56

标签: python forms python-requests

我需要重现以下POST表单结构: enter image description here

根据我的发现,我可以通过以下方式表示sites密钥的多个值:how to post multiple value with same key in python requests?

但如何将此多值键与常规键actionextype结合使用?我不能再使用普通的dict参数了。

1 个答案:

答案 0 :(得分:1)

我不明白为什么你不能使用"常规字典"。相反:

[HttpPost]
public ActionResult excel(Student st)      
{
    Excel.Application app = new Excel.Application();
    Excel.Workbook myworkbook = app.Workbooks.Add(System.Reflection.Missing.Value);
    //  Excel.Worksheet mysheet = myworkbook.ActiveSheet ; 
    ///////write header in excel
    mysheet.Cells[1, 1] = "ID";
    mysheet.Cells[1, 2] = "Name";
    mysheet.Cells[1, 3] = "Email";
    mysheet.Cells[1, 4] = "Age";
    mysheet.Cells[1, 5] = "PassWord";
    mysheet.Cells[1, 6] = "Confirm";       

    int row = 2;       

    //putting received data from create action in excel sheet.
    mysheet.Cells[row, 1] = st.ID;
    mysheet.Cells[row, 2] = st.Name;
    mysheet.Cells[row, 3] = st.E_Mail;
    mysheet.Cells[row, 4] = st.Age;
    mysheet.Cells[row, 5] = st.PassWord;
    mysheet.Cells[row, 6] = st.Confirm;


    // save the data 
    myworkbook.SaveAs("f:\\myfirstexcelmvc.xls");
    myworkbook.Close();

    Marshal.ReleaseComObject(myworkbook);
    app.Quit();
    Marshal.FinalReleaseComObject(app);
}